RTRIM


Removes surrounding substrings or characters on the right side of a string

Syntax:
declare function Rtrim ( byref str as const string, [ Any ] byref trimset as const string = " " ) as string
declare function Rtrim ( byref str as const wstring, [ Any ] byref trimset as const wstring = Wstr(" ") ) as wstring

Usage:
result = Rtrim[$]( str [, [ Any ] trimset ] )

Parameters:
str
The source string.
trimset
The substring to trim.

Return Value:
Returns the trimmed string.

Description:
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 trimmed.

If the Any keyword is used, any character matching a character in trimset will be trimmed.

All comparisons are case-sensitive.

Examples:
Dim s1 As String = "Article 101  "
Print "'" + RTrim(s1) + "'"
Print "'" + RTrim(s1, " 01") + "'"
Print "'" + RTrim(s1, Any " 10") + "'"

Dim s2 As String = "Test Pattern aaBBaaBaa"
Print "'" + RTrim(s2, "Baa") + "'"
Print "'" + RTrim(s2, Any "Ba") + "'"

will produce the output:

'Article 101'
'Article 101  '
'Article'
'Test Pattern aaB'
'Test Pattern '


Platform Differences:
Dialect Differences:
Differences from QB:
See also:
Back to String Functions
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode