LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

parsing an equivalent of scanf

Some short background:  I'm working on a project (that is consuming my soul, but that is a different story).  In this project I have a variable library that I can request entries from... the library stores relevant information to the specific test being run (SN, operator, etc).

 

When it comes time to automatically save data, I need to name the file something and I thought "Hey, it sure would be nice if I gave them the option to specify a unique file name string based on library entries".  So, I decided to parse the string like the C scanf function, where you have all of the time format strings as well as %s which represents library entries.

 

Below is my code that does just that.  My question is:  string parsing is, hands down, my least favorite thing to do in LabVIEW.  This solution seems a little brute force.  Any suggestions on improving it?  scanf.png

0 Kudos
Message 1 of 4
(3,748 Views)

I would do something like this.  The Search And Replace String can come in handy here.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 4
(3,732 Views)

That... is much simpler.  It will also make some of the string error checking easier as well.  Thank you.

 

I really need to learn regular expressions better.

 

 

0 Kudos
Message 3 of 4
(3,719 Views)

@BowenM wrote:

I really need to learn regular expressions better.


You and me both.  Luckily I don't have any in this.  Well, some would say the Scan From String does.  I don't since that format is directly in the help for the Scan From String, which does not support regular expressions.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 4
(3,707 Views)