Rozdeliť reťazec podľa char v Jave

Príklady kódu

1
0

java ako rozdeliť reťazec na písmená

//Java program to show the use of Split method (Java 8 and above)
public class SplitString{

  public static void main(String[] args) 
  {
    //Initialize the String which needs to be split
    String str = "Enlighter";
    
    //Use the Split method and store the array of Strings returned in a String array.
    String[] arr = str.split("");
    
    //Printing the characters using for-each loop
    for(String character : arr)
      System.out.print(char);
0
0

rozdeľte každý znak do reťazca (java)

 class Test {
         public static void main( String[] args) {
             String[] result = "Stack Me 123 Heppa1 oeu".split("\\a");                                                                                   

             // output should be
             // S
             // t
             // a
             // c
             // k
             // M
             // e
             // H
             // e
             // ...
             for ( int x=0; x<result.length; x++) {
                 System.out.println(result[x] + "\n");
             }
         }
     }
0
0

split každý znak v reťazci (java)

 class Test {
         public static void main( String[] args) {
             String[] result = "Stack Me 123 Heppa1 oeu".split("\\a");                                                                                   

             // output should be
             // S
             // t
             // a
             // c
             // k
             // M
             // e
             // H
             // e
             // ...
             for ( int x=0; x<result.length; x++) {
                 System.out.println(result[x] + "\n");
             }
         }
     }

V iných jazykoch

Táto stránka je v iných jazykoch

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................