Java examples for Language Basics:String
Trim method removes white space characters (spaces, tabs, newlines ... ) from the start and end of a word.
public class Main { public static void main(String[] args) { String s = " test test "; s = s.trim();/*from w ww . ja va 2s .c o m*/ System.out.println(s); } }