# Remove spaces at the beginning and at the end of a sting
txt = " Hello World "
print(txt.strip())
# Output - "Hello World"
String withSpaces = " Hi ";
String withoutSpaces = withSpaces.trim();
String str = "Hello ";
System.out.println(str.trim()); // "Hello"