[ACCEPTED]-splitting a string based on delimiter-javascript

Accepted answer
Score: 14
result = "part1/part2".split('/')
result[0] = "part1"
result[1] = "part2

0

Score: 4

split the string and get part 1

'part1/part2'.split('/')[0]

0

Score: 2
var tokens = 'part1/part2'.split('/');

0

Score: 1
var delimeter = '/';

var string = 'part1/part2';

var splitted = string.split(delimeter);

alert(splitted[0]); //alert the part1

0

Score: 1
var result = YourString.split('/');

For your example result will be an array 1 with 2 entries: "part1" and "part2"

More Related questions