RTrim

This reference topic applies to FQL v4. Go to this page for the latest FQL v10 reference topics.

RTrim( value )
RTrim( value )
RTrim( value )
rtrim( value )
RTrim( value )

Description

The RTrim function removes all trailing white spaces, tabs, and new lines from the end of a string.

Parameters

Parameter Type Definition and Requirements

value

String

The String which should have its trailing white spaces, tabs, and new lines removed.

Returns

A String which has all of the trailing white spaces, tabs, and new lines removed.

Examples

The following query executes an array of independent RTrim operations and returns the results in an array. The result array position matches the execution array position. The individual operations are:

  1. The string `Fire ` is processed, removing the trailing space. The result string "Fire" is placed in the top position of the result array.

  2. The string Fire\n\n\t\t , which contains embedded tabs, new lines, and spaces at the end of the string, is processed. The result string Fire is placed in the second position of the result array.

try
{
    Value result = await client.Query(
        Arr(
            RTrim("Fire    "),
            RTrim("Fire\n\n\t\t  ")
        )
    );

    Console.WriteLine(result);
}
catch (Exception e)
{
    Console.WriteLine($"ERROR: {e.Message}");
}
Arr(StringV(Fire), StringV(Fire))
result, err := client.Query(
	f.Arr{
		f.RTrim("Fire    "),
		f.RTrim("Fire\n\n\t\t  "),
	})

if err != nil {
	fmt.Fprintln(os.Stderr, err)
} else {
	fmt.Println(result)
}
[Fire Fire]
client.query(
  [
    q.RTrim('Fire    '),
    q.RTrim('Fire\n\n\t\t  '),
  ]
)
.then((ret) => console.log(ret))
.catch((err) => console.error(
  'Error: [%s] %s: %s',
  err.name,
  err.message,
  err.errors()[0].description,
))
[ 'Fire', 'Fire' ]
result = client.query(
  [
    q.rtrim("Fire    "),
    q.rtrim("Fire\n\n\t\t  "),
  ]
)
print(result)
['Fire', 'Fire']
[
  RTrim('Fire    '),
  RTrim('Fire\n\n\t\t  '),
]
[ 'Fire', 'Fire' ]
Query metrics:
  •    bytesIn:  49

  •   bytesOut:  28

  • computeOps:   1

  •    readOps:   0

  •   writeOps:   0

  •  readBytes:   0

  • writeBytes:   0

  •  queryTime: 2ms

  •    retries:   0

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!