暂无图片
PostgreSQL starts_with() 函数如何使用?
我来答
分享
L
lelepapa
2023-01-12
PostgreSQL starts_with() 函数如何使用?

PostgreSQL starts_with() 函数如何使用?

我来答
添加附件
收藏
分享
问题补充
3条回答
默认
最新
墨水先生

PostgreSQL starts_with() 函数

PostgreSQL starts_with() 函数检查一个字符串是否以一个指定的前缀开头。

starts_with() 语法

这里是 PostgreSQL starts_with() 函数的语法:

starts_with(string, prefix)

参数

string
必需的。 一个字符串。
prefix
必需的。 一个字符串。

返回值

如果字符串 string 以指定的前缀 prefix 开头, starts_with() 函数返回 true (t),否则返回 false (f)。

starts_with() 示例

这个示例演示了如何使用 starts_with() 检查一个字符串是否拥有指定的前缀:

SELECT starts_with('HelloWorld', 'Hello');

 starts_with
-------------
 t

这里,HelloWorld 以 Hello 开头,因此 starts_with('HelloWorld', 'Hello') 返回了 t

SELECT starts_with('HelloWorld', 'World');

 starts_with
-------------
 f

这里,HelloWorld 不以 World 开头,因此 starts_with('HelloWorld', 'Hello') 返回了 f

暂无图片 评论
暂无图片 有用 5
暂无图片
游湖

PostgreSQL starts_with() 函数检查一个字符串是否以一个指定的前缀开头。

暂无图片 评论
暂无图片 有用 3
D
dyf1

PostgreSQL starts_with() 函数检查一个字符串是否以一个指定的前缀开头。

暂无图片 评论
暂无图片 有用 2
回答交流
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
暂无图片墨值悬赏