MySQL TRIM函数是否不修剪换行符或回车符? [英] Does the MySQL TRIM function not trim line breaks or carriage returns?
问题描述
根据我的实验,似乎没有这样做.如果确实如此,那么消除断行的最佳方法是什么?我目前正在试验TRIM接受的要删除字符的参数,从修剪\n
和\r
开始.
From my experiments, it does not appear to do so. If this is indeed true, what is the best method for removing line breaks? I'm currently experimenting with the parameters that TRIM accepts of the character to remove, starting with trimming \n
and \r
.
推荐答案
Trim()
在MySQL中仅删除空格.
Trim()
in MySQL only removes spaces.
除非您反复使用Trim()
,否则我不相信有一种内置的方法可以删除MySQL中所有类型的尾随和前导空格.
I don't believe there is a built-in way to remove all kinds of trailing and leading whitespace in MySQL, unless you repeatedly use Trim()
.
我建议您使用另一种语言来清理当前数据,并确保从现在开始对输入内容进行清理.
I suggest you use another language to clean up your current data and simply make sure your inputs are sanitized from now on.
这篇关于MySQL TRIM函数是否不修剪换行符或回车符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!