Jump to content

Recommended Posts

Posted (edited)

Not sure how i can accurately detect if a specific character in a string is a digit.  The problem is that that I'm dealing with strings which contain a mix of numbers and alpha characters - so using the Number function is giving me inaccurate results.  In the example shown below, C results as a number, again because I'm using the Number function on it.  Feel the need to use Number to convert it from a string though.  Not sure how to get around this.

any recommendations?

;~ $sData = "2123abc3234"
$sData = "c2123abc3234"

If StringIsDigit(Number(StringLeft($sData, 1))) = 1 Then
    ConsoleWrite("digit" & @CRLF)
EndIf

Thanks in advance!

Edited by gcue

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...