how to split a string in java
String string = "004-034556";
String[] parts = string.split("-");
String part1 = parts[0]; // 004
String part2 = parts[1]; // 034556
// 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);
}
}
Also in Java:
- demo java file
- how to close a jframe in java with an if statement
- déclarer un tableau en java
- Could not resolve project :app
- tostring() java example
- java function for power
- java how to print an array
- java integer to binary string with leading zeros
- function in java
- how to change top of window in java
- java dictionary
- java new string array
- java function without return
- java while loop example
- shortcut to find a class in java project eclipse
- how to make a pre set list java
- import java.util.*;
- java long to int
- how to remove components from a JFRame java
- add a value to a list java in java hashmap
- java scanner input int
- if else program in java
- how to find substring in java
- FORM EN JAVA SCRIPT