ASC |
Asc function returns the NUMBER code that represents the specific character |
|
syntax: Asc ( string ) |
For example: |
|
Asc ("K") |
return 75. |
Instr |
Instr function returns the position of the first occurrence of a string in another string. |
|
Syntax: |
Instr ( [start], string_being_searched, string2, [compare] ) |
start is optional. It is the starting position for the search. If this parameter is omitted, the search will begin at position 1.
string_being_searched is the string that will be searched.
string2 is the string to search for.
compare is optional. This is the type of comparison to perform. The valid choices are: |
|
VBA Constant |
Value |
Explanation |
vbUseCompareOption |
-1 |
Uses option compare. |
vbBinaryCompare |
0 |
Binary comparison |
vbTextCompare |
1 |
Textual comparison |
vbDatabaseCompare |
2 |
Comparison based on your database. |
|
For example: |
|
Instr (1, "Krishna", "s") |
return 4 |
Mid |
Mid function extracts a substring from a string (starting at any position). |
|
Mid ( text, start_position, number_of_characters ) |
Text is the string that you wish to extract from.
Start_position indicates the position in the string that you will begin extracting from. The first position in the string is 1.
Number_of_characters indicates the number of characters that you wish to extract. If you omit this parameter, the Mid function will return all characters after the start_position |
For Example: |
|
Mid ("Online Tutorials ", 1, 4) |
return "Onli" |
|
Mid ("Alphabet",7, 2) |
return "Tu" |
|
Mid ("Online", 5) |
return "e" |
Str |
Str function returns a string representation of a number. |
|
Syntax: Str ( number ) |
|
For example: |
|
Str (30) |
return " 30 " |
Chr |
Chr function returns the character based on the |
|
syntax: Chr ( number_code ) |
|
For example: |
|
Chr (75) |
would return "K" |
LCase function converts a string to lower-case. |
Syntax: LCase ( text )
|
For Example: |
|
LCase ("Online Tutorials on the Web ") |
return "online tutorials on the web " |
UCase function converts a string to all upper-case. |
|
Syntax: UCase ( text ) |
|
For Example: |
|
UCase ("Online Tutorials") |
return "ONLINE TUTORIALS" |
Replace function replaces a sequence of characters in a string with another set of characters (a number of times). |
|
Replace ( string1, find, replacement, [start, [count, [compare]]] ) |
For Example: |
|
Replace("Online","line","Come") |
return "OnCome" |
Concatenate strings |
For Example: |
|
"On"&"line" |
return "Online" |
|
"Online" &" " & "Tutorials" |
|
Left |
Left function extracts a substring from a string, starting from the left-most character. |
|
Syntax: Left ( text, number_of_characters ) |
For Example: |
|
Left ("Online Tutorials ", 4) |
return "Onli" |
Right |
Right function extracts a substring from a string starting from the right-most character. |
|
Syntax: Right ( text, number_of_characters ) |
For Example: |
|
Right("Online Tutorials",7) |
torials |
Trim |
Trim function removes leading and trailing spaces from a string. |
|
Syntax: Trim ( text ) |
|
For Example: |
|
|
Right(" Online Tutorials") |
"Online Tutorials" |
LTrim |
LTrim function removes leading spaces from a string. |
|
Syntax: LTrim ( text ) |
|
For Example: |
|
|
Right(" Online Tutorials") |
"Online Tutorials" |
RTrim |
LTrim function removes leading spaces from a string. |
|
Syntax: RTrim ( text ) |
|
For Example: |
|
|
Right("Online Tutorials ") |
"Online Tutorials" |
|