PostgreSQL 判断字符串中是否含有指定字符
PostgreSQL 大约 593 字正则表达式
使用~
符号,A ~ B
表示:A
中是否包含B
。
返回值类型:boolean
。
示例:查询test_column
列中的值包含abc
字符串的记录。
select * from test where test_column ~ 'abc';
position 函数
position(substring in string)
。
position('B' in 'A')
:B
字符串在A
中的索引位置。
返回值类型:int
。
示例:查询aa
字符串在abcd
字符串中的索引位置,返回0
表示aa
没有出现在abcd
中。
select position('aa' in 'abcd');
示例:查询b
字符串在abcd
字符串中的索引位置,返回2
表示b
出现在abcd
中的第2
个位置。
select position('b' in 'abcd');
strpos 函数
strpos(string, substring)
。
strpos('A', 'B')
:B
字符串在A
中的索引位置。
返回值类型:int
。
示例:查询aa
字符串在abcd
字符串中的索引位置,返回0
表示aa
没有出现在abcd
中。
select strpos('abcd', 'aa');
示例:查询c
字符串在abcd
字符串中的索引位置,返回3
表示c
出现在abcd
中的第3
个位置。
select strpos('abcd', 'c');
阅读 161 · 发布于 2023-11-08
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb扫描下方二维码关注公众号和小程序↓↓↓

昵称:
随便看看
换一批
-
Angular error TS2564: Property 'xx' has no initializer and is not definitely assigned in the constructor.阅读 1036
-
Linux 之 CentOS 安装 JDK 及 JRE阅读 2945
-
MySQL server has gone away阅读 2461
-
Linux 常用命令之网络相关命令阅读 2152
-
Java JDBC 开启事务阅读 1687
-
Windows 子系统初始化报错:参考的对象类型不支持尝试的操作阅读 5109
-
走进 Rust;高级 trait阅读 281
-
Win10 激活码密钥阅读 3074
-
Docker 部署 PostgreSQL阅读 1326
-
IDEA 新主题 UI阅读 315