Trim a space from a string

I'm looking for the best way to trim a spaces from a variable.  Like Trim()!
LVL 1
khagenAsked:
Who is Participating?
 
knightEknightConnect With a Mentor Commented:
or,

<%=str.trim()%>
0
 
knightEknightCommented:
String str = "  hi  there   ";
String str2 = str.trim();
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.