Answers for "how to remove leading space in java"

0

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() );
   }
}
Posted by: Guest on March-04-2022

Code answers related to "how to remove leading space in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language