How can I get all the digits at the beginning of a string?
Here is an example string: 1&days=800&trans=9aq8ojjfka24qnl10ohktibfs1
In the example above, I would need to extract 1.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you need the leading digits – including mulitple zeros – you can scan the string for it. If none exists, the value will be
NULL:Outpupt (Demo):
If you do not need leading zeroes, do what vascowhite suggested, that is pretty straight forward. Otherwise:
Returns an integer, too.