hive:函数:substr

substr(string A, int start,int length)

参数:

A为要截取的字符串

start为下标

length为截取的长度 

select substr('你好明天',0,3) filed;
返回:
你好明
select substr('你好明天',1,3) filed;
返回:
你好明
说明:下标从1开始

select substr('你好明天',1,2) filed;
返回:
你好
select substr('你好明天',2,2) filed;
返回:
好明
select substr('你好明天',2,3) filed;
返回:
好明天
select substr('你好明天',3,3) filed;
返回:
明天

猜你喜欢

转载自blog.csdn.net/weixin_38750084/article/details/93380704