我们如何在MySQL中检索指定字符串的长度?
MySQL中的CHAR_LENGTH()或CHARACTER_LENGTH()字符串函数用于检索指定字符串的长度。此函数将仅计算字符数,而忽略字符是单字节还是多字节。
示例
mysql> Select CHAR_LENGTH('New Delhi');+--------------------------+
| CHAR_LENGTH('New Delhi') |
+--------------------------+
| 9 |
+--------------------------+
1 row in set (0.00 sec)
mysql> Select CHAR_LENGTH('NewDelhi');
+-------------------------+
| CHAR_LENGTH('NewDelhi') |
+-------------------------+
| 8 |
+-------------------------+
1 row in set (0.00 sec)
mysql> Select CHARACTER_LENGTH('NewDelhi');
+------------------------------+
| CHARACTER_LENGTH('NewDelhi') |
+------------------------------+
| 8 |
+------------------------------+
1 row in set (0.00 sec)
mysql> Select CHARACTER_LENGTH('New Delhi');
+-------------------------------+
| CHARACTER_LENGTH('New Delhi') |
+-------------------------------+
| 9 |
+-------------------------------+
1 row in set (0.00 sec)
以上是 我们如何在MySQL中检索指定字符串的长度? 的全部内容, 来源链接: utcz.com/z/338346.html