LENGTH

Stai visualizzando una vecchia versione di questo article. Visualizza la versione più recente.

Sintassi

LENGTH(str)

Spiegazione

Restituisce la lunghezza della stringa str, misurata in byte. Per i caratteri multi-byte, vengono contati i byte piuttosto che i caratteri. Questo significa che per una stringa contenente cinque caratteri di un byte, LENGTH() restituisce 10, mentre CHAR_LENGTH() restituisce 5.

Esempi

MariaDB [test]> SELECT LENGTH('MariaDB');
+-------------------+
| LENGTH('MariaDB') |
+-------------------+
|                 7 |
+-------------------+
1 row in set (0.00 sec)

MariaDB [test]> SELECT LENGTH('un testo');
+--------------------+
| LENGTH('un testo') |
+--------------------+
|                  8 |
+--------------------+
1 row in set (0.00 sec)

Commenti

Sto caricando i commenti......
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.