trim.php
Table of Contents
Functions
- trim() : string
- Removes whitespace or specific characters from the start and/or end of a string.
Functions
trim()
Removes whitespace or specific characters from the start and/or end of a string.
trim(string $value[, string|int|null $charsOrType = null ]) : string
This helper wraps the ArangoDB AQL function TRIM(value, chars) which removes
whitespace characters from both ends of a string. You can specify custom
characters to remove instead of the default whitespace.
- Whitespace mode (numeric
typeargument) When the second parameter is an integer, it defines which part of the string should be stripped of whitespace:
0→ start and end (default)1→ start only2→ end only
TRIM(" hello ", 0) // "hello"
TRIM(" hello ", 1) // "hello "
TRIM(" hello ", 2) // " hello"
- Character mode (string
charsargument) When the second parameter is a string, it defines a set of characters to remove from both ends of the value, instead of whitespace.
TRIM("***hello***", "*") // "hello"
Parameters
- $value : string
-
The string or AQL expression to trim.
- $charsOrType : string|int|null = null
-
Optional:
int→ whitespace mode (0,1,2)string→ characters to strip (e.g."*")
Tags
Return values
string —The AQL expression representing the TRIM() call.