I have this string from mysql DB: it should be this: 2100428169/2010
this is my code
String str = rs.getString("str");
str = str.replaceAll("\\s+","");
str = str.trim();
char[] strCH = str.toCharArray();
and I get this:
[, 2, 1, 0, 0, 4, 2, 8, 1, 6, 9, /, 2, 0, 1, 0]
Why?
It's a problem because I need to use str1.equals(str) but it doesn't work because after
Object obj = (object)str;
It is in obj again with a space at the beginning like when I use toCharArray
so it means equals
doesn't work.
I finally found solution:
it was problem because of ASCII 65279 is something from BOM and trim() doesn't work for it.
this helped:
str = str.replace("\uFEFF", "");