Trim

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

Syntax
	KeyPgDeclareDeclare KeyPgFunctionFunction Trim ( 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 Trim ( 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

Usage
	result = Trim[$]( 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 left (beginning) 
	and 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.

Example
	Dim s1 As String = " ... Stuck in the middle ... "
	Print "'" + Trim(s1) + "'"
	Print "'" + Trim(s1, Any " .") + "'"

	Dim s2 As String = "BaaBaaaaB With You aaBBaaBaa"
	Print "'" + Trim(s2, "Baa") + "'"
	Print "'" + Trim(s2, Any "Ba") + "'"

	will produce the output:


	'... Stuck in the middle ...'
	'Stuck in the middle'
	'aaB With You aaB'
	' With You '		

Platform Differences
	* DOS version/target of FreeBASIC does not support the wide-character 
	  version of Trim.

Dialect Differences
	* Not available in the CompilerOptlang-lang qb dialect unless referenced with the 
	  alias __Trim.
	* 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).

Differences from QB
	* New to FreeBASIC

See also
	* KeyPgLtrimLTrim 
	* KeyPgRtrimRTrim

