Tools Links Login

GBIC: Strings

The following is reprinted for archival purposes from Gary Beene's Information Center, with permission from Mr. Beene himself.


"abc" is a String consisting of the three letters a, b, and c

a string variable is assigned content as follows:

mystring = "abc"

'two strings can be merged with the & operator

mystring = "abc" & "def" = "abcdef"

VB has really wide range of functions that perform string operations

Leftreturns # of characters at left of string
Rightreturns # of characters at right of string
Trimremoves spaces from both ends of a string
LTrimremoves spaces from left side of a string
RTrimremoves spaced from right side of a string
Ucase make entire string upper case
Lcase makes entire string lower case
Mid returns any or all of a string (substring)
Chr returns string character associated with an integer (see Ascii values)
Asc returns Ascii integer value of a single character
Len retruns the length of a string (number of characters in the string)
Lset left justifies a string in a string of specified width, padding with spaces as needed
Rset right justifies a string in a string of specified width, padding with spaces as needed
String retuns a string consisting of a character, repeated a specified number of times
Spacereturns a specified number of spaces
InStrfinds position of one string inside a larger string (position defined as starting from the left of the string)
InStrRevfinds position of one string inside a larger string (position defined as starting from the right of the string)
Like compares two string and returns a Boolean result
Replacereplaces a part of a string with a specified replacement string
Joinjoins the elements of an array into a single string, separated by a specified delimeter
Splitseparates a string into an array. separation is made at a specified delimeter
StrCompcompares two strings for equality - with various options
StrReversereverse the order of characters in a string
StrConvconverts a string to various formats (upper, lower, proper, ...)
Format formats an expression to a user-define format. format is defined by a string
FormatCurrencyformats a number as currency
FormatDateTimeformats an expression as date and time
FormatNumberformats a number with various options
FormatPerCentformats a number as a percent

About this post

Posted: 2021-02-11
By: ArchiveBot
Viewed: 187 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.