Text
Note:
- these functions do not modify the string value passed in. Instead, they return a new modified string;
- the first character in a string has 0 index. Keep it in mind when working with functions that take the character index, such as
Insert
Asc
Function | Parameters | Return value |
---|---|---|
Asc |
char c |
int |
Returns an Integer
value representing the character code corresponding to a character.
Example:
Asc('A') = 65
Chr
Function | Parameters | Return value |
---|---|---|
Chr |
int i |
char |
Returns the character associated with the specified character code.
Example:
Chr(65) = 'A'
Insert
Function | Parameters | Return value |
---|---|---|
Insert |
string s, int startIndex, string value |
string |
Inserts a value
substring into the s
string at a specified index position startIndex
and returns a new string.
Example:
Insert("ABC", 1, "12") = "A12BC"
Length
Function | Parameters | Return value |
---|---|---|
Length |
string s |
int |
Returns the length of s
.
Example:
Length("ABC") = 3
LowerCase
Function | Parameters | Return value |
---|---|---|
LowerCase |
string s |
string |
Converts all characters of s
to lower case and returns a result.
Example:
LowerCase("ABC") = "abc"
PadLeft
Function | Parameters | Return value |
---|---|---|
PadLeft |
string s, int totalWidth |
string |
Right-aligns the characters in the s
string, padding with spaces on the left for a total width specified in the totalWidth
parameter.
Example:
PadLeft("ABC", 5) = " ABC"
Function | Parameters | Return value |
---|---|---|
PadLeft |
string s, int totalWidth, char paddingChar |
string |
Right-aligns the characters in the s
string, padding with paddingChar
characters on the left for a total width specified in the totalWidth
parameter.
Example:
PadLeft("ABC", 5, '0') = "00ABC"
PadRight
Function | Parameters | Return value |
---|---|---|
PadRight |
string s, int totalWidth |
string |
Left-aligns the characters in the s
string, padding with spaces on the right for a total width specified in the totalWidth
parameter.
Example:
PadRight("ABC", 5) = "ABC "
Function | Parameters | Return value |
---|---|---|
PadRight |
string s, int totalWidth, char paddingChar |
string |
Left-aligns the characters in the s
string, padding with paddingChar
characters on the right for a total width specified in the totalWidth
parameter.
Example:
PadRight("ABC", 5, '0') = "ABC00"
Remove
Function | Parameters | Return value |
---|---|---|
Remove |
string s, int startIndex |
string |
Deletes all the characters from the s
string beginning at startIndex
position and continuing through the last position.
Example:
Remove("ABCD", 3) = "ABC"
Function | Parameters | Return value |
---|---|---|
Remove |
string s, int startIndex, int count |
string |
Deletes a number of characters specified in the count
parameter from the s
string, beginning at a startIndex
position.
Example:
Remove("A00BC", 1, 2) = "ABC"
Replace
Function | Parameters | Return value |
---|---|---|
Replace |
string s, string oldValue, string newValue |
string |
Returns a string s
in which a specified substring oldValue
has been replaced with another substring newValue
.
Example:
Replace("A00", "00", "BC") = "ABC"
Substring
Function | Parameters | Return value |
---|---|---|
Substring |
string s, int startIndex |
string |
Retrieves a substring from the s
string. The substring starts at a character position specified in the startIndex
parameter.
Example:
Substring("ABCDEF", 4) = "EF"
Function | Parameters | Return value |
---|---|---|
Substring |
string s, int startIndex, int length |
string |
Retrieves a substring from the s
string. The substring starts at a character position specified in the startIndex
parameter and has a length specified in the length
parameter.
Example:
Substring("ABCDEF", 1, 3) = "BCD"
TitleCase
Function | Parameters | Return value |
---|---|---|
TitleCase |
string s |
string |
Converts the specified string to titlecase.
Example:
TitleCase("john smith") = "John Smith"
Trim
Function | Parameters | Return value |
---|---|---|
Trim |
string s |
string |
Removes all occurrences of white space characters from the beginning and end of the s
string.
Example:
Trim(" ABC ") = "ABC"
UpperCase
Function | Parameters | Return value |
---|---|---|
UpperCase |
string s |
string |
Converts all characters of s
to upper case and returns a result.
Example:
UpperCase("abc") = "ABC"