mysql的replace函数

 

将单引号与双引号的替换,有时候在json处理中需要:

 

dba@xxx ((none)) > select replace('xxxx"12345"677777','\"',"'");
+---------------------------------------+
| replace('xxxx"12345"677777','\"',"'") |
+---------------------------------------+
| xxxx'12345'677777                     |
+---------------------------------------+
1 row in set (0.07 sec)

Thu Nov 12 17:14:03 2020
dba@xxx ((none)) > select replace("xxxx'12345'677777","'",'\"');
+---------------------------------------+
| replace("xxxx'12345'677777","'",'\"') |
+---------------------------------------+
| xxxx"12345"677777                     |
+---------------------------------------+
1 row in set (0.07 sec)

Thu Nov 12 17:15:44 2020

 

 

 

 

 

 

 

 

 

 

 

###################################

上一篇:bug原因:判断Integer相等,用==不行


下一篇:求新数和倍数(输入正整数n和0~9范围内的一个数m,判断m是否存在于n中(用函数实现),若不存在则输出“m不存在于n中”(m和n以具体输入的值代替))