Answers for "split string and push into array javascript"

2

javascript split string into array by comma and space

input.split(/[ ,]+/); //splits string using RegEx on a space OR a comma
Posted by: Guest on June-11-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

Code answers related to "split string and push into array javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language