mysql字符串函数:
1.字符串连接
concat();
例子: select concat(‘php’,‘linux’);
2.转小写
lcase();
例子: select lcase(‘PHP IS VERY MUCH!’);
3.转大写:
ucase();
例子: select id,ucase(username),age from user;
4.长度
length();
例子: select length(‘linux’);
5.取除左边的空格
ltrim();
例子: select length(ltrim(’ linux’));
6.取除右边的空格
rtrim();
例子: select length(rtrim('linux '));
7.重复
repeat();
例子: select concat(repeat(’-’,20),‘linux’);
8.替换
replace();
例子: select replace(‘linux and java’,‘linux’,‘php’);
9.截取
substring();
例子: select substring(’/usr/local/src’,6,5);
10.空格
space();
例子: select concat(‘linux’,space(20),‘php’);