[ACCEPTED]-splitting a string based on delimiter-javascript
Accepted answer
result = "part1/part2".split('/')
result[0] = "part1"
result[1] = "part2
0
split the string and get part 1
'part1/part2'.split('/')[0]
0
var tokens = 'part1/part2'.split('/');
0
var delimeter = '/';
var string = 'part1/part2';
var splitted = string.split(delimeter);
alert(splitted[0]); //alert the part1
0
var result = YourString.split('/');
For your example result will be an array 1 with 2 entries: "part1" and "part2"
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.