在 Java 中,我有一个这样的字符串:
" content ".
String.trim()
会删除这些边上的所有空格还是每边只删除一个空格?
最佳答案
Returns: A copy of this string with leading and trailing white space removed, or this string if it has no leading or trailing white space.
~ Quoted from Java 1.5.0 docs
(但你为什么不自己试试看呢?)
关于java - Java String.trim() 将删除多少个空格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2198875/