Answers for "space separated strings java"

1

space seperator in string in java

String[] splitted = "peter,james,thomas".split(",");
Posted by: Guest on August-13-2020
0

how to read space separated characters in java

# Let input sequence is like ' A B C D E F ( 9 5 a b z '

while(Scanner.hasNextLine()){
  String[] c = fileReader.nextLine().split(" ");
  for(int i=0;i<c.length;i++){
      System.out.print("My character is " + c[i] + " "); 
      // this is enough for the input sequence
      // but if you want a safe approach then use it
      for(int j=0;j<c[i].length;j++){
          System.out.print("My character is " + c[j].charAt(j) + " ");
   	  }
}
Posted by: Guest on May-27-2021

Code answers related to "space separated strings java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language