From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Compare ASCII Characters

I scan a barcode and the barcode contains 16 characters.  Using 0 as my first character, I have a single letter (a to z or A to Z, upper or lower case).  In positions 5 and 6 I have two letters (a to z or A to Z).  How do I ensure that the first character is a letter and not a number in TestStand (3.0)?  The second example has two consecutive letters (any combination of, either upper or lower case), how do ensure these two characters are letters and not numbers or special characters? Positions 0, 5 and 6 will always have a letter, never a number and never the same.
 
Tony
0 Kudos
Message 1 of 4
(3,106 Views)

Hi,

TestStand is a bit limited in this, you would be better doing it a code module in either C  or labVIEW.

 

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 2 of 4
(3,095 Views)

If you still want to do it in TestStand, you have Mid(), Asc(), Chr(), <, >, ==, StrComp(), etc.. to manipulate and compare strings and characters.

For example, it you want to know if a particular character is alphabetic:

Locals

.characterInUpperCase = ToUpper(Mid(Locals.stringOfInterest, Locals.characterIndex, 1)),

Locals

.isAlphabetic = StrComp(Locals.characterInUpperCase , "A") >= 0 && StrComp(Locals.characterInUpperCase , "Z") <= 0

Admittedly, an IsApha() function would be nice. 

Message 3 of 4
(3,076 Views)

That is what I ultimately will do.  In fact have already begun and it seems to work.  Thanks for your assistance.

Tony

0 Kudos
Message 4 of 4
(3,072 Views)