Asc
Chr
Format
IsDigit
IsLetter
IsNumber
IsPunctuation
StrAt
StrCompare
StrIndexOf
StrInsert
StrLength
StrRemove
StrReplace
StrToLower
StrToUpper
SubString
Asc Top
Returns the ASCII number of the first character in the string.
Syntax: Asc (String)
Example: I = Asc ("0") ' I = 45
Chr Top
Returns the ASCII character represented by the given number.
Syntax: Chr (Integer)
Integer ranges from 0 to 255.
Example:
Msgbox (Chr(34) & "Hello" & Chr(34))
This example shows a message box with : "Hello" (including the quotes).
Format Top
Returns a string representing a given number in a specific format.
Syntax: Format (Number, Format String)
Format string can be:
* Dn - Integer number with a minimum of n digits. It will add leading zeros if needed.
* En - Scientific number (d.dddde-010) with n digits after the decimal point.
* Fn - Fixed Point with n digits after the decimal point.
* Nn - Number format (dd,ddd,ddd.dddddd) with n digits after the decimal point.
* Pn - Percent format. Multiplies the number with 100 and adds the percent sign.
Example:
Msgbox (Format(1234.5678,"N2"))
Will display: 1,234.57
IsDigit Top
Returns true if the first character in the string is a digit.
Syntax: IsDigit (String)
Example:
If IsDigit (StrAt (TextBox1.Text,2)) = True Then ...
It will be true if the third character is a digit.
IsLetter Top
Returns true if the first character in the string is a letter.
Syntax: IsLetter (String)
Example:
If IsLetter (StrAt (TextBox1.Text,2)) = True Then ...
It will be true if the third character is a letter.
IsNumber Top
Return true if the string is a number.
Syntax: IsNumber (String)
Example:
If IsNumber(TextBox1.Text) = true Then
Msgbox (TextBox1.Text * 20)
End If
IsPunctuation Top
Returns true if the first character in the string is a punctuation symbol.
Syntax: IsPunctuation (String)
Example:
If IsPunctuation (StrAt (TextBox1.Text,2)) = True Then ...
It will be true if the third character is a punctuation symbol.
StrAt Top
Returns the character at a specific position.
Syntax: StrAt (String, Index)
Index starts from 0 to String length - 1.
Example: a = StrAt ("abcdef" , 3)
Result: a = "d"
StrCompare Top
Compares two string and returns a value depending on the lexical order of the strings.
Syntax: StrCompare (String, String [,Compare Constant])
Compare Constant can be: cCaseSensitive or cCaseUnsensitive.
StrCompare returns a number less than zero if the first string is less than the second string.
It returns zero if the strings are equal and a number greater than zero if the first string is greater than the second string.
If the Compare Constant is omitted, the comparing will be not case sensitive.
Example:
i = StrCompare (TextBox1.Text, TextBox2.Text, cCaseSensitive)
If i = 0 Then
Msgbox("Both equal")
Else If i<0 Then
Msgbox("TextBox1 is smaller")
Else
Msgbox("TextBox2 is smaller")
End If
StrIndexOf Top
Returns the index of the first letter in the matching string, starting from a given index.
If the matching string isn't found then it will return -1.
Syntax: StrIndexOf (String, Value, StartIndex)
Value is the string that is searched in String.
Example:
Msgbox (StrIndexOf ("abcdef" , "cd",0))
Result : Displays 2.
Example:
Msgbox (StrIndexOf ("abcdef" , "ab",1))
Result: Displays -1 (not found)
StrInsert Top
Returns a new string after inserting a string to the old string.
Syntax: StrInsert (String, StartIndex, Value)
Example:
Old = "12567"
New = StrInsert (Old,2,"34")
Result: New = "1234567"
StrLength Top
Returns the length of a string (number of characters).
Syntax: StrLength (String)
Example: Msgbox (StrLength ("Basic4ppc"))
Result: Displays 9
StrRemove Top
Returns a new string after removing some characters from the old string.
Syntax: StrRemove (String, StartIndex, Count)
Example:
Old = "Basic4ppc"
New = StrRemove (Old ,6 , 3)
Result: New = "Basic4"
StrReplace Top
Returns a new string after replacing the old value (in the old string) with the new value.
Like all the other string keywords it doesn't change the old string value.
Syntax: StrReplace (String , Old Value, New Value)
Example:
s = "The sun is bright"
s = StrReplace (s," ","") 'remove white spaces
Result: s = "Thesunisbright"
StrToLower Top
Returns a new string from the old string that its letters are lower case.
Syntax: StrToLower (string)
Example: Msgbox (StrToLower("AbCdE"))
Result: Displays "abcde"
StrToUpper Top
Returns a new string from the old string that its letters are uppercase.
Syntax: StrToUpper (string)
Example: Msgbox (StrToUpper("AbCdE"))
Result: Displays "ABCDE"
SubString Top
Returns a new string that is made of part of an old string.
Syntax: SubString (String, StartIndex, Count)
If the length of the new string is beyond the length of the original string then white spaces will be added to it.
Example:
Old = "Basic4ppc"
New = SubString (old,6, StrLength (old) - 6)
Result: New = "ppc"
This example shows how to copy a string from a specific point to the end using StrLength.