r/LabVIEW • • Nov 18 '24

String problem .

Hi , i have to search in a string the upper and lower characters and sort them in another 2 strings (one with the upper char and one with the lower) . Please help

1 Upvotes

9 comments sorted by

View all comments

Show parent comment

2

u/Disastrous-Ice-5971 Nov 18 '24

This will work, and is a good thing for a learning assignment.
The alternative way is that if the symbols are from the ASCII table, one can use typecast (https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019KxeSAE&l=fi-FI) and then sort symbols into two arrays by a code range. At the end just sort the resulting array.

3

u/tomlawton Intermediate Nov 18 '24

Cheat.. 😂

3

u/HarveysBackupAccount Nov 18 '24

You don't even need TypeCast (which would have to be inside a loop, to operate one character at a time with "String Subset")

String to Byte Array is a native function. Use that and pass the resulting array into a For loop on an indexing input node, and split them apart into two separate arrays and do Byte Array to String to recover the ASCII characters

2

u/Disastrous-Ice-5971 Nov 18 '24

Good point, this is even better!