LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SCAN FROM STRING

Shane,

It is safer to use a regular expression to remove the last character. An
application can never tell if 3.5m means 0.0035 or 3.5 meter, so it is
application dependant.

However the upper example will pass the string until an optional prefix is
encountered (3.5m will become 0.0035), and will also work if no unit is
used.

The ^ and $ options in the match pattern have really enriched my LabVIEW
experience! E.g. remove spaces from the end of a string is just \s*$. Spaces
from the begin ^\s*. Split a string at the second last space
\s[^\s]*\s[^\s]*$. It's really great!

Regards,

Wiebe.


"shoneill" wrote in message
news:506500000005000000B0630100-1077587809000@
exchange.ni.com...
> While running the risk of repeating myself, wow. I can actually think
> of instances where this would be quite useful for me.
>
> Beats manually searching for the "m", "M" or "u" units.
>
> It's just a shame it doesn't work if the input string is 4.3uW for
> example instead of 4.3u Still, clipping the last character from the
> string isn't so much work.....
>
> Thanks again.
>
> Shane.



[Attachment Format Into String.vi, see below]
0 Kudos
Message 11 of 12
(416 Views)
I've solved my problem with %.;%f .
Thanks to all the people for your help.
IMMA
0 Kudos
Message 12 of 12
(416 Views)