Oihana PHP Arango

ltrim.php

Table of Contents

Functions

ltrim()  : string
Remove whitespace from the start of a string.

Functions

ltrim()

Remove whitespace from the start of a string.

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

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

Example AQL usage:

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

String expression to trim from the left.

$chars : string|null = null

Optional characters to remove (defaults to whitespace).

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

$expr = ltrim('doc.title');
// Produces: 'LTRIM(doc.title)'

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

For trimming from the right.

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