android - Java String TRIM function not working -
i receiving string server trailing 1 or 2 lines of spaces below given string.
string str = "abc******* ********";
consider * spaces after string
i have tried few methods like
str = str.trim(); str = str.replace(string.valueof((char) 160), " ").trim(); str = str.replaceall("\u00a0", "");
but none working. why not able remove space?
you should try this:
str = str.replaceall("\n", "").trim();
you can observe there new line in string . first replace new line "\n" space("") , trim
Comments
Post a Comment