10-25-2018 06:04 PM
@rafael.assis16 wrote:
Below is what I did. I changed the spaces by * and then converted to array. How could I now, from this array, count the characters of each value?
Did you change the problem? A 2D array of strings is not a count of spaces between commas.
10-25-2018 07:06 PM
I have to ask again, what is the final purpose of this exercise? What do you do with this information? It seems pointless to count all the spaces and all the amounts of all the different characters. If it's homework to exercise your LabVIEW skills, that's fine; just tell us so we know how to help you. If the goal is something else, let us know. There's probably a better way to arrive at your destination.
10-26-2018 02:17 AM - edited 10-26-2018 02:42 AM
@rafael.assis16 wrote:
Below is what I did. I changed the spaces by * and then converted to array. How could I now, from this array, count the characters of each value?
For each string value? In a for loop, use String Length function.
The 2nd array element would indeed give you the number of characters between the commas.
So you could also get the 2nd element (Index Array) and then use String Length...
This doesn't seem very efficient compared to other suggestions...
EDIT: BTW: not sure why the replace at the start is for. Not useful at all when you are interested in the number of characters between commas.
10-26-2018 12:24 PM
@billko escreveu:
I have to ask again, what is the final purpose of this exercise? What do you do with this information? It seems pointless to count all the spaces and all the amounts of all the different characters. If it's homework to exercise your LabVIEW skills, that's fine; just tell us so we know how to help you. If the goal is something else, let us know. There's probably a better way to arrive at your destination.
Good afternoon, this topic is not a homework, it was a real problem I was having with a string where I had several comma-separated information. I needed to count those words to use elsewhere in the program, but a few words came with spaces and I needed to know what word and space was, so I wanted to tell and then I would delete what I did not need. This string is defined in another program where I can not change. But next week I will talk to the technician to see if there is any possibility of changing the string that is sent to my program.
10-26-2018 02:22 PM
@rafael.assis16 wrote:
@billko escreveu:
I have to ask again, what is the final purpose of this exercise? What do you do with this information? It seems pointless to count all the spaces and all the amounts of all the different characters. If it's homework to exercise your LabVIEW skills, that's fine; just tell us so we know how to help you. If the goal is something else, let us know. There's probably a better way to arrive at your destination.
Good afternoon, this topic is not a homework, it was a real problem I was having with a string where I had several comma-separated information. I needed to count those words to use elsewhere in the program, but a few words came with spaces and I needed to know what word and space was, so I wanted to tell and then I would delete what I did not need. This string is defined in another program where I can not change. But next week I will talk to the technician to see if there is any possibility of changing the string that is sent to my program.
Thank you for being so patient. So it sounds like you're trying to determine field lengths for something? A database record? Maybe a communications protocol? If you replace the space with an empty string instead of an asterisk, the spaces will disappear and then you can get an accurate character count.