您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

Oracle的substr函数简单用法

2024/11/17 18:55:05发布26次查看
substr(字符串,截取开始位置,截取长度) //返回截取的字
substr('hello world',0,1) //返回结果为 'h'  *从字符串第一个字符开始截取长度为1的字符串
substr('hello world',1,1) //返回结果为 'h'  *0和1都是表示截取的开始位置为第一个字符
substr('hello world',2,4) //返回结果为 'ello'
substr('hello world',-3,3)//返回结果为 'rld' *负数(-i)表示截取的开始位置为字符串右端向左数第i个字符
测试:
select substr('hello world',-3,3) value from dual;
附:java中substring(index1,index2)的简单用法
作用:从字符串索引(下标)为index1的字符开始截取长度为index2-index1 的字符串。
string str=hello world;
system.out.println(str.substring(0,5));
打印结果为:hello
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product