Java字符串拆分每个字符

代码示例

2
0

分裂中的每个字符串入阵java

String s="abcd";
char[] a=s.toCharArray();
1
0

将字符串中的每个字符拆分为数组java

String s="abcd";
char[] a=s.toCharArray();
1
0

java如何将字符串拆分为字母

//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

分裂中的每个字符串(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");
             }
         }
     }

类似页面

带有示例的类似页面

其他语言

此页面有其他语言版本

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