Alpha or numeric

In Developer, does anyone know how to test a character and determine whether it’s numeric?

have a look in the PSUtilities package (can be downloaded from Advantage), it contains a PSUtilities.string:isNumeric service

hth

graham

if you don’t want to use PSUtilities, you can use a branch and regular expressions:

branch on /instring
/[1]$/
/[2]+$/

The first expression (which would appear in the label on the branch step, and would include the slashes) will match a string which contains exactly one digit.

The second expression will match a string which is composed of nothing but digits.

For those unfamiliar with regular expressions, the second one above can be translated as

match any string beginning with (specified by the ^) one or more (specified by the +) characters falling in the range of 0-9 (specified by [0-9]) followed by the end of string (specified by the $).


  1. 0-9 ↩︎

  2. 0-9 ↩︎