I have a string that contains some text followed by a blank line. What's the best way to keep the part with text, but remove the whitespace newline from the end?
Use String.trim() method to get rid of whitespaces (spaces, new lines etc.) from the beginning and end of the string.
String.trim()
String trimmedString = myString.trim();
2.1m questions
2.1m answers
60 comments
57.0k users