LabVIEW Idea Exchange

About LabVIEW Idea Exchange

Have a LabVIEW Idea?

  1. Browse by label or search in the LabVIEW Idea Exchange to see if your idea has previously been submitted. If your idea exists be sure to vote for the idea by giving it kudos to indicate your approval!
  2. If your idea has not been submitted click Post New Idea to submit a product idea to the LabVIEW Idea Exchange. Be sure to submit a separate post for each idea.
  3. Watch as the community gives your idea kudos and adds their input.
  4. As NI R&D considers the idea, they will change the idea status.
  5. Give kudos to other ideas that you would like to see in a future version of LabVIEW!
Top Authors
cancel
Showing results for 
Search instead for 
Did you mean: 

Contract multiple delimiters for "Spreadsheet string to array"

Status: New

(I thought something similar was suggested before, but I cannot find it).

 

It is often necessary to deal with "malformed" spreadsheet strings, where there is more than one possible delimiter.

 

One example is discussed here, where a delimiter is either ",", "N", or a combination of the two, but the same has come up before. In my typical case, users sometimes use notepad to edit spreadsheet files, randomly replacing tabs with multiple spaces, multiple tabs, or a combination of tabs and spaces, so it "looks" aligned, but spreadsheet string to array will choke on it.

 

"Scan strings for tokens" has that useful feature to allow the definition of multiple delimiters as an array and (by default) consecutive delimiters are contracted into one (option "allow empty tokens?"=false). This makes it easy to parse lines (delimiters: \n, \r) or fields (delimiters: \t, \s). An example to deal with dirty strings is given here.

 

"Spreadsheet string to array" already accepts arrays of delimiters, but they are treated as alternatives and multiple consecutive delimiters are NOT contracted into one. I suggest to add an option to "Spreadsheet string to array" where multiple consecutive delimiters will be contracted into one for parsing. (or it could be named "allow empty tokens?" as above for simplicity, default=true to keep current behavior)

 

For example if I wire a delimiter array containg a single space element, it would treat multiple spaces as one.

If the delimiter array contains a tab and a space, consecutive spaces and tabs (in any order) will act as a single delimiter. The above quoted example would have a delimiter array containing two elements, "N" and ",".

 

Suggestion: add a boolean input to treat multiple consecutive delimiters as a single delimiter. For example, the two code fragments in the image should give basically the same result (The upper part is slightly defective and would need a little bit more code if lines end in a delimiter, but I think the idea should be clear).

 

The suggestion is at the bottom:

 

 

 

 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
4 Comments
Knight of NI

I like the suggestion.  It would eliminate many Rube-G code out there.

 

______________________________________________________________________
Member

can you send me this programme,,

Knight of NI

> can you send me this programme,,

 

This is the idea exchange, not a help forum! If you need help with programming, please ask in the LabVIEW forum and use a link to this idea to illustrate your needs. Have you tried recreating the code from the picture? Make sure all the delimiters are set to '\'-codes display. What is your LabVIEW version?


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Proven Zealot

I'd like a pattern match (or even better, a reg.ex.) option, like the search and replace function.

 

So multiple characters can be specified as "[,:;]", but we'd also be able to do fancy things like "row[0-9]+".