开发者

Problem getting substring in jquery

开发者 https://www.devze.com 2023-01-08 18:14 出处:网络
I have a string variable having data 4096;jpg,bmp or 2048;flv,mpg I want to split this string into two string in jquery o开发者_如何学JAVAn the basis of ;You can use JavaScript\'s split function

I have a string variable having data

4096;jpg,bmp

or

2048;flv,mpg

I want to split this string into two string in jquery o开发者_如何学JAVAn the basis of ;


You can use JavaScript's split function.

var some_text = "blah;blah;blahness";
var arr = some_text.split(';');
alert(arr[2]); //blahness


here is some code..

var str = '4096;jpg,bmp';
var elements = str.split(';');

alert( elements[0] ); // 4096
alert( elements[1] ); // jpg,bmp
0

精彩评论

暂无评论...
验证码 换一张
取 消