admin管理员组文章数量:1426197
I have a string like
this-is-my-0-string. this-is-my-new-1-string-occur.
i want to break string where number occurs
like
this-is-my , 0 , string
and this-is-my-new,1, string-occur
in mon words i need to break my string where numbers occur. number is any from 0, 99999 is it possible to do in javascript or jquery ? How to do this
Thanks in advance
I have a string like
this-is-my-0-string. this-is-my-new-1-string-occur.
i want to break string where number occurs
like
this-is-my , 0 , string
and this-is-my-new,1, string-occur
in mon words i need to break my string where numbers occur. number is any from 0, 99999 is it possible to do in javascript or jquery ? How to do this
Thanks in advance
Share Improve this question asked Dec 28, 2012 at 7:20 Hitu BansalHitu Bansal 3,13712 gold badges55 silver badges89 bronze badges 2- i tried simple split function . it doesnot make sense – Hitu Bansal Commented Dec 28, 2012 at 7:23
- You should split with regex. – user1326628 Commented Dec 28, 2012 at 7:34
1 Answer
Reset to default 8It's using split alright.
var string1 = "this-is-my-0-string. this-is-my-new-1-string-occur.";
var parts = string1.split(/-(\d)-/);
alert(parts);
You can play around here.
本文标签: javascriptjQuery Split where numeric number occurStack Overflow
版权声明:本文标题:javascript - jQuery Split where numeric number occur - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745413596a2657580.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论