LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scan String Problem

I got an error when I run the attached code.  When I get rid o the comma after the last %s, the error would be gone though.  What's going on?

 

yik

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 1 of 3
(2,702 Views)

%s matches a string up to the next space, I believe.  Since a comma is a valid character, %s is matching "C,".  If you specify %1S then you can keep the comma because it will match only 1 character, and the comma will not be part of the match.

 

Wow, I'm actually learning this regular expression nightmare.

- tbob

Inventor of the WORM Global
Message 2 of 3
(2,698 Views)

 


@tbob wrote:

 

Wow, I'm actually learning this regular expression nightmare.


 

This is actually a format string, which to most people is just a bad dream.

 

If you do not know the length of the LocCT string you could replace '%s,' or '$1s,' with '%[^,],' which will give you a string with all characters except a comma followed by a comma.

0 Kudos
Message 3 of 3
(2,685 Views)