strrtrim()
Cuts certain characters out of a string, starting from the right.
Synopsis
string strrtrim(string s [, string trimstr]);
Parameters
Parameter | Description |
---|---|
s | Original string |
trimstr | List of characters to be trimmed |
Return value
Trimmed string
Errors
Missing or incorrect arguments
Description
Cuts the characters in the string trimstr out of the string s, from right to left, and returns the thus trimmed string s. As soon as a character occurs in s that does not occur in trimstr the operation is terminated. If trimstr is empty or not a string, the untrimmed string s is returned. trimstr is optional, by default a trim string containing white spaces is used. This trims trailing spaces, tabs, returns etc. from s.
Note that the second parameter of this function defines a list of characters to be deleted and not a string, which should be deleted!
Example
The following example trims all the characters ".as" from the string s until it encounters the first character not contained in the trim string.
main()
{
string s;
s="Nameasas.asas..as";
s=strrtrim(s, ".as"); // Result "Name"
DebugN(s); // Print the result
}
Assignment
Strings
Availability
CTRL