trimright

The trimright function enables you to remove white space from the right side of a string by default. You can also specify a character for the trimright function to remove from the right side of a string. If you want to remove a character, specify the character in the appropriate case (upper- or lowercase).

Syntax

Use this syntax:


string = trimright(string_to_trim) or 
string = trimright(string_to_trim, character_to_trim)
 
where: string = string field that contains the end result
       string_to_trim = string field containing the value to be trimmed
       character_to_trim = character to trim from string (no empty spaces)

Examples

Use the following syntax to remove white space from the right of the string:


string [25] s;
s = "   my String    ";
$Groupname[1].#Value = trimright(s);
 
//$Groupname[1].#Value now contains the value "   my String"

Use the following syntax to remove a trailing character:


string [25] s1;
s1 = "Stringzzz";
$Groupname[1].#Value = trimright(s1,"z");
 
//$Groupname[1].#Value now contains the value "String"

For similar examples, see trim.