Splite ของจาวา

รหัสตัวอย่าง

34
0

วิธีที่จะแบ่งข้อความในงานจาวา

String string = "004-034556";
String[] parts = string.split("-");
String part1 = parts[0]; // 004
String part2 = parts[1]; // 034556
14
0

วิธีที่จะแบ่งข้อความในงานจาวา

// Java program to demonstrate working of split(regex, 
// limit) with small limit. 
public class GFG { 
    public static void main(String args[]) 
    { 
        String str = "geekss@for@geekss"; 
        String[] arrOfStr = str.split("@", 2); 
  
        for (String a : arrOfStr) 
            System.out.println(a); 
    } 
} 
12
0

แยกวิธีการอยู่ในงานจาวา

public class SplitExample2 { 
    public static void main(String args[]) 
    { 
        String str = "My name is Chaitanya";
        //regular expression is a whitespace here 
        String[] arr = str.split(" "); 
  
        for (String s : arr) 
            System.out.println(s); 
    } 
}
1
0

แยกกันอน ในของจาวา

String textfile = "ReadMe.txt";
String filename = textfile.split(".")[0];
String extension = textfile.split(".")[1];

หน้าคล้ายกัน

คล้ายกันหน้ากับตัวอย่าง

ในภาษาอื่นๆ

หน้านี้อยู่ในภาษาอื่นๆ

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