If your particular String consists of a newline character that's invisible (not n but is 0A in hexadecimal as this value is passed on in the database), how do i in a position to chomp it away? Will Apache Chomp help?


The hex type of the written text came back in the database is "5761 6920 4D61 6E0D 0A"

It means "Wai Guy" having a carriage return.

Use a regular expression

String text = "Hello\r\nThere\r\n";
String shortText = text.replaceAll("\r", "");