Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

how to remove leading space in java

import java.io.*;
public class Main {
   public static void main(String args[]) {
      String str = new String(" Jack Sparrow ");
      System.out.println("String: "+str);
      System.out.print("Result after removing leading and trailing spaces:" );
      System.out.println(str.trim() );
   }
}
 
PREVIOUS NEXT
Tagged: #remove #leading #space #java
ADD COMMENT
Topic
Name
5+1 =