The Trim method removes from the current string all leading and trailing white-space characters . Each leading and trailing trim operation stops when a non-white-space character is encountered. For example, if the current string is ” abc xyz “, the Trim method returns “abc xyz”.
Read moreWhat is the difference between trim and strip Java?
strip() vs trim() strip() is Unicode whitespace aware , whereas the existing method trim() removes any space which is less than or equal to (\u0020).
Read moreHow do you trim an object in Java?
The trim() Method public String trim(); The trim() method of a String object creates a new String that is the same as the original except that any leading or trailing space is trimmed off (removed).
Read more