LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
John_Deans

Allow string to be treated as arrays

Status: Declined

Any idea that has received less than 4 kudos within 4 years after posting will be automatically declined.

Back in my Pascal days I could access string as an array. This made processing of data presented as a string much easier.  In Labview I have to convert the sting to an array then process the elements. This would not be too bad if their was ASCII option in the radix for a unsigned integer or case structure

 

 

7 Comments
LuI
Active Participant
Active Participant

There are primitives to switch strings to array of characters.

There are some problems with unicode, though. But I have not yet tried this out.

John_Deans
Member

I agree that a string can be converted to an array of unsigned bytes, but then you have to use the ASCII numeric values in case statements or comparisons

I had a situation where I wanted to convert some data arriving in a string to an array on (typdef'd) enums. I converted the string to an array of  U8 and fed then to a case structure in a FOR loop It would have been easier to understand the code if I could have put X,Y etc in the case statement but I had to use the ASCII numeric values 89, 90 etc instead

JÞB
Knight of NI

"I wanted to convert some data arriving in a string to an array on (typdef'd) enums"

You mean like using scan from string????

 

Whoops.png


"Should be" isn't "Is" -Jay
AristosQueue (NI)
NI Employee (retired)

> In Labview I have to convert the sting to an array then process the elements.

 

And this is a very good thing, especially as we try to move to unicode support. That's been a painful enough process as it stands, and keeps hitting problems, but we keep working on it. But the diagram mutation problems would be doubled, and possibly impossible to solve, if LV had not long ago made the distinction between strings and arrays of bytes. If you want the individual bytes, use the Type Cast node and cast it over.

John_Deans
Member

Could you then add ASCII to the radix list (Display Format tab) for unsigned Integers and case statements when presented with unsigned input

AristosQueue (NI)
NI Employee (retired)

@6829:   I made your comment into its own idea here.

Darren
Proven Zealot
Status changed to: Declined

Any idea that has received less than 4 kudos within 4 years after posting will be automatically declined.