November 2004
Intermediate to advanced
400 pages
10h 31m
English
You need to remove a trailing newline or carriage return from a string.
Use
StringUtils.chomp( ) to
remove the last line termination sequence from a string:
String input = "Hello\n"; String chomped = StringUtils.chomp( input ); // chomped equals "Hello" String input2 = "Another test\r\n"; String chomped2 = StringUtils.chomp( input2 ); // chomped2 equals "Another test";
Read now
Unlock full access