split method in java
Java
// 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);
}
} String string = "004-034556";
String[] parts = string.split("-");
String part1 = parts[0]; // 004
String part2 = parts[1]; // 034556
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);
}
}
Also in Java:
- Title
- change brightness of image in java
- Category
- Java
- Title
- java int to binary
- Category
- Java
- Title
- convert date to calendar java
- Category
- Java
- Title
- java cast duration to long
- Category
- Java
- Title
- java replace element in list
- Category
- Java
- Title
- java 8 iterating and manipulating list
- Category
- Java
- Title
- arraylist java methds
- Category
- Java
- Title
- java 8 group a collections by 2 property
- Category
- Java
- Title
- java best way to concatenate strings
- Category
- Java
- Title
- java public static void main
- Category
- Java
- Title
- how to remove duplicates from an array java
- Category
- Java
- Title
- check if optional is empty java
- Category
- Java
- Title
- iterate through hashmap in java
- Category
- Java
- Title
- how to know if String is the same java
- Category
- Java
- Title
- processing pi
- Category
- Java
- Title
- query java persistence
- Category
- Java
- Title
- programa que convierete un archi de c a java
- Category
- Java
- Title
- random processing
- Category
- Java
- Title
- change the value in a hashtable java
- Category
- Java
- Title
- java random number in range
- Category
- Java
- Title
- java how to read a text file
- Category
- Java
- Title
- how to create a button in java
- Category
- Java
- Title
- raise number to power java
- Category
- Java
- Title
- init cap java
- Category
- Java
- Title
- how to make a dictionary in java
- Category
- Java
- Title
- java literals w3schools
- Category
- Java
- Title
- how to get elements of a list in java
- Category
- Java
- Title
- online money transfer andhra bank
- Category
- Java
- Title
- how to create an array of arraylist in java
- Category
- Java
- Title
- biginteger in java
- Category
- Java
- Title
- append to arraylist by index java
- Category
- Java
- Title
- java get environment variables
- Category
- Java
- Title
- fibonacci sequence in java recursion
- Category
- Java
- Title
- java stack
- Category
- Java
- Title
- java get icon for file type
- Category
- Java
- Title
- how do you concatenate an int with a string in java
- Category
- Java
- Title
- java remove double spaces
- Category
- Java
- Title
- has been compiled by a more recent version of the Java Runtime (class file version 56.0), this version of the Java Runtime only recognizes class file versions up to 55.0
- Category
- Java
- Title
- java logical operator
- Category
- Java
- Title
- java 8 hashmap example stackoverflow
- Category
- Java
- Title
- how to sort collection in java
- Category
- Java
- Title
- java random number
- Category
- Java
- Title
- How to print in console java
- Category
- Java
- Title
- read a file in java and store as integer array using buffered reader
- Category
- Java
- Title
- java null pointer exception
- Category
- Java
- Title
- generate random number java
- Category
- Java
- Title
- java newinstance alternative
- Category
- Java
- Title
- java hashmap syntax
- Category
- Java
- Title
- java make arraylist
- Category
- Java
- Title
- how to create a java jframe
- Category
- Java
- Title
- initialize scanner java
- Category
- Java
- Title
- java thread
- Category
- Java
- Title
- java stack peek
- Category
- Java
- Title
- string to double java exception
- Category
- Java
- Title
- check java version
- Category
- Java
- Title
- how to select a random element from an array in java
- Category
- Java
- Title
- java string to character stream
- Category
- Java
- Title
- when to use serializable in java
- Category
- Java
- Title
- java calculator code
- Category
- Java
- Title
- android java convert double to 2 decimal places
- Category
- Java
- Title
- how to use spring in java
- Category
- Java
- Title
- The shrinker may have failed to optimize the Java bytecode. To disable the shrinker, pass the `--no-shrink` flag to this command.
- Category
- Java
- Title
- how to remove all items from alist in java
- Category
- Java
- Title
- java fileinputstream
- Category
- Java
- Title
- check last character of string java
- Category
- Java
- Title
- error attribute fabattached not found
- Category
- Java
- Title
- java exit
- Category
- Java
- Title
- how to get array input in java
- Category
- Java
- Title
- get current unix timestamp java
- Category
- Java
- Title
- java hahmap
- Category
- Java
- Title
- java time code
- Category
- Java
- Title
- how to initialize array in java
- Category
- Java
- Title
- how to install java runtime environment on centos 7
- Category
- Java
- Title
- tableau de classe java
- Category
- Java
- Title
- java string is null or empty
- Category
- Java
- Title
- int to binary java
- Category
- Java
- Title
- java 8 map foreach
- Category
- Java
- Title
- foreach java
- Category
- Java
- Title
- Error executing Maven. java.io.FileNotFoundException: The specified user settings file does not exist: /etc/java-8-openjdk
- Category
- Java
- Title
- inputstream to string java
- Category
- Java
- Title
- Java 2 dimensional array equals
- Category
- Java
- Title
- boolean parse jtextfield
- Category
- Java
- Title
- how to create a Rectangle in java
- Category
- Java
- Title
- sum of arraylist java 8
- Category
- Java
- Title
- find min in array java
- Category
- Java
- Title
- array declaration and initialization in java
- Category
- Java
- Title
- split with scquere braket in java
- Category
- Java
- Title
- islowercase java
- Category
- Java
- Title
- create instance object java
- Category
- Java
- Title
- toString convert to long
- Category
- Java
- Title
- make class in java
- Category
- Java
- Title
- Method used for getting metadata of a database in jdbc
- Category
- Java
- Title
- java loop hashmap
- Category
- Java
- Title
- final variables in java
- Category
- Java
- Title
- spring-boot actuator not working
- Category
- Java
- Title
- counting the number of characters in a string java
- Category
- Java
- Title
- java collapse string array
- Category
- Java
- Title
- send variable intent
- Category
- Java
- Title
- java array swap
- Category
- Java
- Title
- java random numbers in specific range
- Category
- Java