VB 6 String Handling

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.

Advertisements

There are two types of strings in VB 6 programming.

  • Variable length strings
  • Fixed length strings
Advertisements

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 FunctionsDescription
StrComp()Compares two strings
StrConv()Convert strings
Format(), LCase, UCaseConvert A string to lowercase
or uppercase
Space(), String()Create strings
Len()Get the length of the string
Format Format a string
LSet, RSetJustify a string
InStr, Left, Mid, Right, Trim,
LTrim, RTrim
Manipulate strings
Option Comparestring comparison values
Asc, ChrUse ASC II and ANSI values
String Handling Functions
Advertisements

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.