Based on the Java docs here, the .trim()
replaces '\u0020' which is commonly known as whitespace.
But take note, the '\u00A0' (Unicode NO-BREAK SPACE
) is also seen as a whitespace, and .trim()
will NOT remove this. This is especially common in HTML.
To remove it, I use :
tmpTrimStr = tmpTrimStr.replaceAll("\\u00A0", "");
An example of this problem was discussed here.