[jawsscripts] Re: detecting numbers

  • From: "Paul Magill" <magills@xxxxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Thu, 9 Jul 2009 19:30:03 +1000

Hi,

Below is a function I use for checking if a string is entirely numeric. 
Just another way of doing it.

By adjusting the string in the StringContains function, you may allow commas 
or decimal points etc.

Int Function StringIsNumeric (string InString)

; returns true if all characters in the stringare numeric

VAR

INT Position

LET Position = StringLength (InString)

IF (Position == 0) THEN

RETURN (False)

ENDIF ; a Nul string

WHILE (Position > 0) && StringContains ("0123456789", SubString (InString, 
Position, 1))

LET Position = Position - 1

ENDWHILE

RETURN (NOT Position) ; true if Position is 0, as all positions in string 
were numeric

EndFunction



Regards,

Paul from Aust



----- Original Message ----- 
From: "Johannes Grib" <johannesg@xxxxxxxxx>


Hello,
No, JAWS currently does not have a "IsNumeric" function so I just test for 
the ascii value range to insure I work with digits.
HTH


__________ 
Visit and contribute to The JAWS Script Repository http://jawsscripts.com

View the list's information and change your settings at 
//www.freelists.org/list/jawsscripts

Other related posts: