Demo
View Source
Enter a string with spaces in front and back and press Trim String button
String:
Trim String