跳到主要内容
版本: 最新版本-3.5

starts_with

当字符串以指定前缀开头时,此函数返回 1。 否则,返回 0。 当参数为 NULL 时,结果为 NULL。

语法

BOOLEAN starts_with(VARCHAR str, VARCHAR prefix)

示例

mysql> select starts_with("hello world","hello");
+-------------------------------------+
|starts_with('hello world', 'hello') |
+-------------------------------------+
| 1 |
+-------------------------------------+

mysql> select starts_with("hello world","world");
+-------------------------------------+
|starts_with('hello world', 'world') |
+-------------------------------------+
| 0 |
+-------------------------------------+

关键词

START_WITH