Oihana PHP Arango

rtrim.php

Table of Contents

Functions

rtrim()  : string
Remove whitespace from the end of a string.

Functions

rtrim()

Remove whitespace from the end of a string.

rtrim(string $value[, string|null $chars = null ]) : string

This helper wraps the ArangoDB AQL function RTRIM(value, chars) which removes whitespace characters from the end (right side) of a string. You can specify custom characters to remove instead of the default whitespace.

Example AQL usage:

RTRIM("  hello world  ")      // returns "  hello world"
RTRIM("***hello***", "*")     // returns "***hello"
RTRIM("hello  ")              // returns "hello"
RTRIM(doc.title)              // removes trailing whitespace from title
Parameters
$value : string

String expression to trim from the right.

$chars : string|null = null

Optional characters to remove (defaults to whitespace).

Tags
example
use function oihana\arango\db\functions\strings\rtrim;

$expr = rtrim('doc.title');
// Produces: 'RTRIM(doc.title)'

$expr = rtrim('doc.title', '"*"');
// Produces: 'RTRIM(doc.title, "*")'
see
https://docs.arangodb.com/stable/aql/functions/string/#rtrim
ltrim()

For trimming from the left.

trim()

For trimming from both sides.

since
1.0.0
author

Marc Alcaraz

Return values
string

The formatted AQL expression.

On this page

Search results