Hi
What string function to be used in jquery +dot.net
In this string
"Saree $20"
"Pant $50"
I want to take the $ amount alone that is 20 and 50..
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
SairamPosted Dec 2, 2011, 2:35 AM
Done as below
if (s.indexOf("$") > -1)
Pravin MorePosted Dec 2, 2011, 2:29 AM
var tempstr= strval.substr ( strval.indexOf ( '$' ) + 1 );
this will work i think, have you tried?
SairamPosted Dec 2, 2011, 2:15 AM
input may be like this
saree $20
saree
saree 100
if $ present in the string then have to take dollar amount else no need
Anuja PawarPosted Dec 2, 2011, 1:57 AM
Pravin MorePosted Dec 2, 2011, 1:29 AM
var strval="Saree $20";
var tempstr= strval.substr ( strval.indexOf ( '$' ) + 1 );
you will get 20 here in tempstr.
n you can parse it to number if you want.
Thanks,
Pravin.