MariaDB: CHAR_LENGTH Function
This MariaDB tutorial explains how to use the MariaDB CHAR_LENGTH function with syntax and examples.
Description
The MariaDB CHAR_LENGTH function returns the length of the specified string (measured in characters).
Syntax
The syntax for the CHAR_LENGTH function in MariaDB is:
CHAR_LENGTH( string )
Parameters or Arguments
- string
- The string to return the length for.
Note
- When using the CHAR_LENGTH function, a multi-byte character is counted as a single character.
- The CHARACTER_LENGTH function is a synonym for the CHAR_LENGTH function.
- See also the LENGTH function.
Applies To
The CHAR_LENGTH function can be used in the following versions of MariaDB:
- MariaDB 10
Example
Let's look at some MariaDB CHAR_LENGTH function examples and explore how to use the CHAR_LENGTH function in MariaDB.
For example:
SELECT CHAR_LENGTH('Tech on the Net'); Result: 15 SELECT CHAR_LENGTH('TechOnTheNet.com'); Result: 16 SELECT CHAR_LENGTH(' '); Result: 1 SELECT CHAR_LENGTH(''); Result: 0 SELECT CHAR_LENGTH(NULL); Result: NULL
Advertisements