且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Java替换方法,替换为空字符

更新时间:2023-10-05 15:06:58

如果你只是用双引号换单,这将是因为空字符串是合法值而起作用。似乎许多人忽略了 replace(CharSequence,CharSequence)实际上对字符串参数起作用的事实:)

If you just exchange single for double quotes, this will work because an empty string is a legal value. It seems that many people overlook the fact that replace(CharSequence, CharSequence) actually works on string arguments :)