{{fbdoc item="title" value="RTRIM"}}----
Removes surrounding substrings or characters on the right side of a string

{{fbdoc item="syntax"}}##
	[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Rtrim** ( [[KeyPgByref|byref]] //str// [[KeyPgAs|as]] [[KeyPgConstQualifier|const]] [[KeyPgString|string]], [ **Any** ] [[KeyPgByref|byref]] //trimset// [[KeyPgAs|as]] [[KeyPgConstQualifier|const]] [[KeyPgString|string]] = " " ) [[KeyPgAs|as]] [[KeyPgString|string]]
	[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Rtrim** ( [[KeyPgByref|byref]] //str// [[KeyPgAs|as]] [[KeyPgConstQualifier|const]] [[KeyPgWstring|wstring]], [ **Any** ] [[KeyPgByref|byref]] //trimset// [[KeyPgAs|as]] [[KeyPgConstQualifier|const]] [[KeyPgWstring|wstring]] = [[KeyPgWstr|Wstr]](" ") ) [[KeyPgAs|as]] [[KeyPgWstring|wstring]]
##
{{fbdoc item="usage"}}##
	//result// = **Rtrim**[$]( //str// [, [ **Any** ] //trimset// ] )
##
{{fbdoc item="param"}}
	##//str//##
		The source string.
	##//trimset//##
		The substring to trim.

{{fbdoc item="ret"}}
	Returns the trimmed string.

{{fbdoc item="desc"}}
	This procedure trims surrounding characters from the right (end) of a source string:
		- Substrings matching ##//trimset//## will be trimmed if specified, otherwise spaces ([[CptAscii|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.

{{fbdoc item="ex"}}
{{fbdoc item="filename" value="examples/manual/strings/rtrim.bas"}}%%(freebasic)
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 '
%%

{{fbdoc item="target"}}
	- DOS version/target of ""FreeBASIC"" does not support the wide-character version of ##**RTrim**##.

{{fbdoc item="lang"}}
	- The string type suffix "$" is required in the //[[CompilerOptlang|-lang qb]]// dialect.
	- The string type suffix "$" is optional in the //[[CompilerOptlang|-lang fblite]]// dialect.
	- The string type suffix "$" is ignored in the //[[CompilerOptlang|-lang fb]]// dialect, warn only with the //[[CompilerOptw|-w suffix]]// compile option (or //[[CompilerOptw|-w pedantic]]// compile option).

{{fbdoc item="diff"}}
	- QB does not support specifying a ##//trimset//## string or the ##ANY## clause.

{{fbdoc item="see"}}
	- ##[[KeyPgLtrim|Ltrim]]##
	- ##[[KeyPgTrim|Trim]]##

{{fbdoc item="back" value="CatPgString|String Functions"}}