java string remove space in begining end code example
Example 1: Which method in an be used to remove any whitespace from both the beginning and the end of a string?
str = "hello "
print(str.trim())
Example 2: remove spaces at beginning and end of string java
String withSpaces = " Hi ";
String withoutSpaces = withSpaces.trim();