Question : split every character in string into array java
Answered by : xenophobic-xenomorph-tyzvetbbcynk
String s="abcd";
char[] a=s.toCharArray();
Source : https://www.quora.com/How-do-you-split-a-word-in-Java | Last Update : Thu, 12 Mar 20
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