# bea-xf:trim-right

Removes the trailing white space from $string-var.

If the value of $string-var is the empty sequence, the following error is displayed in the mapper:

    Error occurred while executing XQuery: Error loading the XQuery or XSLT for this method: Type error in function trim-right invocation: expected type [string@http://www.w3.org/2001/XMLSchema], given type empty

The empty sequence is a sequence containing zero items (), which is similar to null in SQL.

### Signatures

bea-xf:trim-right(xs:string $string-var) —> xs:string

### Arguments

Data Type | Argument | Description
--- | --- | ---
xs:string | $string-var | Represents the string to trim.

### Returns

Returns $string-var after the removal of the trailing white space.

### Examples

#### Remove Trailing Spaces

Invoking trim-right(" abc ") returns the string " abc" as shown in the following example query:

    <result>{bea-xf:trim-right("   abc   ")}</result>

The preceding query, generates the following XML result:

    <result>    abc</result>

#### Error—Null

Invoking trim-right(()) outputs an error. The string: () is the empty sequence (similar to a SQL null) which is a sequence containing zero items.

For example, the following example query:

    <result>{bea-xf:trim-right(())}</result>

Outputs the following error:

    Error occurred while executing XQuery: Error loading the XQuery or XSLT for this method: Type error in function trim-right invocation: expected type [string@http://www.w3.org/2001/XMLSchema], given type empty

### XQuery Compliance

Not a standard W3C XQuery function.