Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   get character from string (http://www.chiefdelphi.com/forums/showthread.php?t=107213)

tilky 07-07-2012 12:28

get character from string
 
is there any way to have a string, lets say 10 characters long, and read each character individually?

Greg McKaskle 07-07-2012 13:39

Re: get character from string
 
The typical approach is to convert it to an array of bytes and wire to a loop to index one character after the other, or to a grown index node to access many at once. The conversion functions for string are in the string palette to the bottom right.

Greg McKaskle

tilky 08-07-2012 10:38

Re: get character from string
 
ok thanks. after a little looking around i found out that in order to take the string of that one character and not the number, i have to use type cast (which i have never used before)

Greg McKaskle 08-07-2012 10:56

Re: get character from string
 
Sorry my other post was so short -- tablets and typing ...

For a little background, a string is identical to an array of characters. So you can convert or cast it back and forth freely depending on which API is more appropriate. The string API is far better for scanning for sequences and patterns, but the array API is sometimes useful for precision work like getting out arbitrary characters and treating them as ASCII bytes.

If you want to extract a portion of a string, even a single character, but still treat it as a string, I'd suggest the string subset node. Indicate which byte and use a size of one. Another useful technique once you have a portion of a string extracted is to wire them to a case structure. The case will switch on Booleans, ints, enums, and strings. You can enter in string elements comma separated to use for matching.

If you need more assistance, be sure to explain more about what you are trying to do.

Greg McKaskle

tilky 08-07-2012 16:58

Re: get character from string
 
the string subset is so much easier. i forgot to use the length input before, so thats why i couldn't figure out how to do it. Thanks for all of your help:D :D :D


All times are GMT -5. The time now is 10:47.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi