Oihana PHP Arango

charLength.php

Table of Contents

Functions

charLength()  : string
Return the number of characters in a string (not byte length).

Functions

charLength()

Return the number of characters in a string (not byte length).

charLength(string $expression) : string

This helper wraps the ArangoDB AQL function CHAR_LENGTH(str) which returns the number of characters in a string, counting Unicode characters properly rather than bytes.

Example AQL usage:

CHAR_LENGTH("hello")          // returns 5
CHAR_LENGTH("café")           // returns 4 (not 5 bytes)
CHAR_LENGTH(doc.title)        // returns character count of title
Parameters
$expression : string

String expression to count characters of.

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

$expr = charLength('doc.title');
// Produces: 'CHAR_LENGTH(doc.title)'
see
https://docs.arangodb.com/stable/aql/functions/string/#char_length
since
1.0.0
author

Marc Alcaraz

Return values
string

The formatted AQL expression.

On this page

Search results