- How to divide a string into single characters
  - The Program
  - The Code:
  - The Source

# How to divide a string into single characters

You can divide a string into single characters with
Mid(myString, x, y)
The substring, which starts at x and ends at y is extracted.
This might be interesting for you too: right(myString, x, y), left(myString, x, y)

## The Program

Just type in a string and click the button.
The label at the bottom will show the first and the last character.

## The Code:

    STATIC PUBLIC SUB Main()
      hForm AS Fmain
      hForm = NEW Fmain
      hForm.show
    END

    PUBLIC SUB _new()
      TextLabel2.Text = "See the first and last character of your INPUT!"
    END

    PUBLIC SUB Button1_Click()
      inword AS String
      outword AS String
      inword = TextBox1.Text
      outword = Mid(inword, 1, 1)
      outword = outword & Mid(inword, Len(inword), 1)

'Len(myString) returns the length of a string

TextLabel1.Text = outword END

## The Source

Download