题解 | 用char_length()、replace(),记得是去掉中文逗号!!!

评论替换和去除

https://www.nowcoder.com/practice/0038f5db08a64ec2851f2e219a06a121

char_length():

统计每个字符的数量(包括中文、英文、符号等,1个中文算1个字符)

函数语法:

char_length(str)

str:要处理的字符串

replace():

将字符串中的指定子串替换成新的子串

函数语法:

replace(str,old_substr,new_substr)

str:要处理的原字符串

old_substr:要被替换的子串

new_substr:替换后的新子串

代码:

select id,replace(comment,',','') as comment
from comment_detail
where char_length(comment)>3;

全部评论

相关推荐

2025-12-30 16:42
同济大学 C++
仁狂躁使者:哎呀,不用担心,我当时配环境配了两天,项目捋不清就问问导师能不能用ai,慢慢就清了,会好起来的
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务