Xbasic
STRIP_TRAILING_CHAR Function
Syntax
Output_String as C = strip_trailing_char(C string [,C chr ])
Arguments
- stringCharacter
The string to examine.
- chrCharacter
Default = chr(92) (the '\' character). The character to remove.
Returns
- Output_StringCharacter
The processed string.
Description
Strips a trailing character from a string. Typically used to string a trailing backslash from a path.
Discussion
The STRIP_TRAILING_CHAR() function removes the specified character from the end of the input string. Unlike the RTRIM() function, however, STRIP_TRAILING_CHAR() only removes the last character from the string if it matches chr.
Example
? strip_trailing_char("C:\Users\Sam\Documents\\")
= "C:\Users\Sam\Documents"
? strip_trailing_char("this is text...",".")
= "this is text.."
? RTRIM("this is text...",".")
= "this is text"See Also