hive:函数:空格字符串函数|重复字符串函数|首字符ascii函数|左补足函数|右补足函数

空格字符串函数:space

语法: space(int n)。返回长度为n的字符串

举例:select length(space(10)) ; ##返回值为10

hive:函数:空格字符串函数|重复字符串函数|首字符ascii函数|左补足函数|右补足函数

重复字符串函数:repeat

语法: repeat(string str, int n)。返回重复n次后的str字符串

hive:函数:空格字符串函数|重复字符串函数|首字符ascii函数|左补足函数|右补足函数

首字符ascii函数:ascii

语法: ascii(string str)。返回字符串str第一个字符的ascii码

举例:select ascii('abcde'); --返回值为97

左补足函数:lpad

语法: lpad(string str, int len, string pad)。将str进行用pad进行左补足到len位

举例:select lpad('abc',10,'td') from dual; #--返回值为tdtdtdtabc 共10位

hive:函数:空格字符串函数|重复字符串函数|首字符ascii函数|左补足函数|右补足函数

右补足函数:rpad

语法: rpad(string str, int len, string pad)。将str进行用pad进行右补足到len位