SyntaxFix
Write A Post
Hire A Developer
Questions
I also had this problem. To sort out the problem of spaces in the middle of the string this line of code always works:
String field = field.replaceAll("\\s+", "");