From the String class: "Returns a copy of the string, with leading and trailing whitespace omitted."
So in your example the String that is returned will contain the same string. trim() is used mainly to clean up user supplied input. [ January 15, 2007: Message edited by: David McCombs ]
"Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration."- Stan Kelly-Bootle
Joined: Sep 10, 2006
Trim() is basically used to remove the trailing spaces. Suppose you are getting the value from a table and the value in the table is Jeff Kiddyxxx, where xxx refer to extra/trailing spaces stored in the table then calling trim() would return in "Jeff Kiddy".