|
08 Strings
' "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
Left
'returns # of characters at left of string
Right
'returns # of characters at right of string
Trim
'removes spaces from both ends of a string
LTrim
'removes spaces from left side of a string
RTrim
'removes 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
Space
'returns a specified number of spaces
InStr
'finds position of one string inside a larger string (position defined as starting from the left of the string)
InStrRev
'finds 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
Replace
'replaces a part of a string with a specified replacement string
Join
'joins the elements of an array into a single string, separated by a specified delimeter
Split
'separates a string into an array. separation is made at a specified delimeter
StrComp
'compares two strings for equality - with various options
StrReverse
'reverse the order of characters in a string
StrConv
'converts a string to various formats (upper, lower, proper, ...)
Format
'formats an expression to a user-define format. format is defined by a string
FormatCurrency
'formats a number as currency
FormatDateTime
'formats an expression as date and time
FormatNumber
'formats a number with various options
FormatPerCent
'formats a number as a percent
|