How do you get rid of the whitespace at the end of a string?

How do you get rid of the whitespace at the end of a string?
Answer
String result =
str.
trim();
The trim() method will remove both leading and trailing whitespace from a string and return the result.
 

Tìm kiếm

Back
Top