Answers for "how can we split a string in java by particular character or space"

1

how can I split string according to space in java?

str = "Hello I'm your String";
String[] splited = str.split("\\s+");
Posted by: Guest on August-09-2021
0

java split string by length

String[] strings = "Thequickbrownfoxjumps".split("(?<=\\G.{4})"); // split all 4 chars
String[] strings = "Thequickbrownfoxjumps".split("(?<=\\G.{100})"); // this would be all 100 chars 
// -> ['Theq', 'uick', 'brow', 'nfox', 'jump', 's']
Posted by: Guest on September-04-2021

Code answers related to "how can we split a string in java by particular character or space"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language