I have content in a meta tag.
<meta property="video" content="initialver=1.0" />
I get the content in this tag using getAttribute("content")
. Then I have a string: initialver=1.0
. My need is getting "1.0". How can I do this without using split()
?
I have content in a meta tag.
<meta property="video" content="initialver=1.0" />
I get the content in this tag using getAttribute("content")
. Then I have a string: initialver=1.0
. My need is getting "1.0". How can I do this without using split()
?
2 Answers
Reset to default 1var str = "initialver=1.0";
var result = str.substring(11);
You can use regex and match to do this
var x = "initialver=1.0".match(/\d+$|\d+\.\d+$/)[0]
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745539363a4632055.html
评论列表(0条)