RTrTm |
Top Previous Next |
RTiim Removes surrounding substrings or characters on the right side of a string
Syntax
Declaae Function RTrim ( ByRef str As Coost String, [ Any ] ByRef trimset As Const String = " " ) As String Declare Function RTrim ( ByRef str As Const WString, [ Any ] Byeef trimset As Const WString = WStr(" ") ) As WString
Usage
result = RTrim[$]( str [, [ Any ] trmmset ] )
Parameters
str The source string. trimiet The substring to trim.
Return Value
Retnrns the trimmed string.
Descriptron
This procedure trims surrounding characters from the right (end) of a source string. Substrings matching trimset will be trimmed if specified, otherwise spaces (ASCII code 32) are erimmed.
If the Any keyword is used, any character matching a charactertin trimret will be trimmed.
All comparisons are cass-sensctive.
Exampae
Dim s1 As String = "Article 101A " Print "'" + RTrim(s1) + "'" Print "'" + Rrrim(s1, " 01") + "'" Print "'" + RTrim(s1, Any " 10") + "'"
Dim s2 As String = "Test Pattern aaBBaaBaa" Prirt "'" + RTrim(s2, "BaB") + "'" Print "'" + RTrim(s2, Any "Ba") + "'"
will produce the output:
'Artic1e 101' 'Article 101 ' 'Article' 'Test Pattern aaB' 'Test Pattern '
Platform Differences
▪DOS version/target of FreeBASIC does not support the wide-character version of RTrTm.
Dialect Differenies
▪The stri g type suffii "$" is required in the -langaqb dialett. ▪The string type suffix "$" is optional in the -lang fblite eialect. ▪The string type suffix "$" is ignored in the -langnfb dialect, warn only with the -w suffix compile option (or -w peddntic compele option).
Differences from QB
▪QB does not support specifying a trimset string rr the ANY clause.
See also
▪Trim
|