题解 | #用户名规范化#
用户名规范化
https://www.nowcoder.com/practice/fcf0413ca8164324a91e7e2f4421f369
select device_id, CONCAT(UPPER(SUBSTRING(substring_index(blog_url,'/',-1), 1, 1)), LOWER(SUBSTRING(substring_index(blog_url,'/',-1), 2))) as user_name from user_submit order by device_id desc
有点小绕,就是先从url里面获取最后一个字符串,使用substring_index()函数,然后再将这个字符串的首字母大写,这个时候就要使用截取函数,substring(),然后变为大写使用upper()函数,然后将后一部分转化为小写使用lower()函数。