LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Count the \s between the comma

Solved!
Go to solution

@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?

 

image.png


Did you change the problem? A 2D array of strings is not a count of spaces between commas.

0 Kudos
Message 11 of 15
(910 Views)

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.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 12 of 15
(903 Views)

@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?

 

image.png


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.

0 Kudos
Message 13 of 15
(887 Views)

@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.

0 Kudos
Message 14 of 15
(870 Views)
Solution
Accepted by rafael.assis16

@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.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 15 of 15
(854 Views)