Search Java Programs

Wednesday, January 20, 2010

Trim() - Java String Methods

Description of code:

trim():
This method removes the blank spaces from both ends of the given string (Front and End).

Here is the code of program:

import java.lang.*;

public class StringTrim{
public static void main(String[] args) {
System.out.println("String trim example!");
String str = " RoseIndia";
System.out.println("Given String :" + str);
System.out.println("After trim :" +str.trim());
}
}

No comments:

Post a Comment

Website Design by Mayuri Multimedia