开发者

How to get the value of a number embedded in text using jQuery

开发者 https://www.devze.com 2023-01-22 05:26 出处:网络
I开发者_如何学JAVA need to find out the value of the numeric part from a string, where the string contains two parts, text and number. There is only one couple of such text. For example number01, data

I开发者_如何学JAVA need to find out the value of the numeric part from a string, where the string contains two parts, text and number. There is only one couple of such text. For example number01, data34 etc.


jQuery not needed:

var myString = 'data34';
var myNumber = myString.match(/\d+/);
alert(myNumber);
0

精彩评论

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