Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java trim method


// Java program to demonstrate working
// of java string trim() method
 
class Gfg {
 
    // driver code
    public static void main(String args[])
    {
 
        // trims the trailing and leading spaces
        String s = " geeks for geeks has all java functions to read  ";
        System.out.println(s.trim());
 
        // trims the leading spaces
        s = " Chetna loves reading books";
        System.out.println(s.trim());
    }
}
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #java #trim #method
ADD COMMENT
Topic
Name
7+1 =