Question : How to split a string in Java
Answered by : mobile-star
String string = "004-034556";
String[] parts = string.split("-");
String part1 = parts[0]; // 004
String part2 = parts[1]; // 034556
Source : | Last Update : Sat, 08 Feb 20
Question : java split string
Answered by : conrad-bhnke
// Split a string by whitespace
String input = "Hello World!";
String[] words = input.split("\\s+");
Source : | Last Update : Wed, 02 Aug 23
Question : java split string
Answered by : n0rther
String yourString = "Hello/Test/World";
String[] strings = yourString.split("/" /*<- Regex */);
Output:
strings = [Hello, Test, World]
Source : | Last Update : Wed, 24 Jun 20
Question : java split string array
Answered by : bewildered-buzzard-u8gl7vxy0y60
Java example to split a string
String str = "A-B-C-D";
String[] strArray = str.split("-");
System.out.println(Arrays.toString(strArray)); // [A, B, C, D]
Source : https://howtodoinjava.com/java/string/java-string-split-example/ | Last Update : Sun, 12 Dec 21
Question : split string into words java
Answered by : william-r67a6wa4xyur
import java.util.Arrays;
class test{ public static void main(String[] args) { String sentence = "this is a sentence!"; String[] words = sentence.split(" "); for (String word : words) { System.out.println(word); } }
}
Source : | Last Update : Fri, 30 Dec 22
Question : split string into array java
Answered by : courageous-camel-y4vfpr8cix55
String[] array = values.split("\\|", -1);
Source : https://stackoverflow.com/questions/14414582/java-split-string-to-array | Last Update : Tue, 10 Nov 20
Question : java how to split a string to array
Answered by : inna-kim
String str= "abcdef"; String[] array=str.split("(?<=\\G.{2})"); System.out.println(java.util.Arrays.toString(array));
Source : | Last Update : Mon, 11 Apr 22