I’m trying to use InStr to find the first character that isn’t a “0” (starting from the left-hand side) in strings like this:
000000000001
000000004092
000000000052
000000001006
Can this be done with InStr, or should I use something different?
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 are looking for an index of an item that is not zero (that may also be a non-digit) use this regular expression:
[^0]Keep in mind, Regex functions require the following library call:
This will not work well when the string is composed entirely of zeros, so you may want to modify the expression to allow zero to be the last (or the only) character in the string: