Remember strings? They are the data type that holds letters, spaces, words and text. In QBasoc we used
- LEN(mystring) to find the length of a string
- LEFT$(mystring, x) to find the first x characters of a string
- RIGHT$(mystring, x) to find the last x characters of a string
- MID$(mystring, y, x) to find x characters of a string starting at position y
A common technique used with strings is to use a FOR loop to cycle through the letters in the string:
FOR i = 1 to LEN(mystring)
PRINT MID$(mystring, i, 1)
NEXT i
What are the equivalent techniques for these functions in Visual Basic? See Program Example 14 String Handling 1.
No comments:
Post a Comment