Earlier you learned about the string data type. The VB 6 language has many functions to handle string types. In this article, we will present the list of those functions with examples.
There are two types of strings in VB 6 programming.
- Variable length strings
- Fixed length strings
To declare variable length string you can use following syntax.
'variable length string declaration
Dim myStr as String
'fixed length string declaration
Dim myFixedStr as String * 20
You can notice that we are using asterisk (*)
to specify the length of the string which is 20 characters.
String Handling Functions in VB 6
String Functions | Description |
StrComp() | Compares two strings |
StrConv() | Convert strings |
Format(), LCase, UCase | Convert A string to lowercase or uppercase |
Space(), String() | Create strings |
Len() | Get the length of the string |
Format | Format a string |
LSet, RSet | Justify a string |
InStr, Left, Mid, Right, Trim, LTrim, RTrim | Manipulate strings |
Option Compare | string comparison values |
Asc, Chr | Use ASC II and ANSI values |