Answers for "how to split string in array"

21

javascript split

// bad example https://stackoverflow.com/questions/6484670/how-do-i-split-a-string-into-an-array-of-characters/38901550#38901550

var arr = foo.split(''); 
console.log(arr); // ["s", "o", "m", "e", "s", "t", "r", "i", "n", "g"]
Posted by: Guest on May-01-2020
4

javascript slice string from character

var input = 'john smith~123 Street~Apt 4~New York~NY~12345';

var fields = input.split('~');

var name = fields[0];
var street = fields[1];
Posted by: Guest on June-28-2020
4

javascript split

var names = 'Harry ;Fred Barney; Helen Rigby ; Bill Abel ;Chris Hand ';

console.log(names);

var re = /\s*(?:;|$)\s*/;
var nameList = names.split(re);

console.log(nameList);
Posted by: Guest on April-25-2020
0

split string into array java

String[] array = values.split("\\|", -1);
Posted by: Guest on November-03-2020
-2

how to saperate string to array

Scanner in=new Scanner(System.in);
		String input=in.nextLine();
		String[] word=input.split(" ");
Posted by: Guest on May-30-2020

Code answers related to "how to split string in array"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language