LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Remove from string all latters

Hello,
 
How do i remove all letters from a string and leave only the numbers and dots.
 
for exsample:
 
if i have " SIZE(321..5666)siz " I only want (321..5666).
The letters will apear randomly so i can not use a splitter.
 
Thanks.
0 Kudos
Message 1 of 4
(3,925 Views)
Hello,

First, in the example string you gave : "SIZE(321..5666)siz" the string you want to extract is between "(" and ")", is it alwasy the case ? you can search for these tokens.

Otherwise, there are different thing you can do, I suggest you have a look at the detailed help for "match pattern" :



Another idea, use the ASCII table to separate numbers (48 to 57 plus 46 for the point) from other characters.

Hope this helps


Message Edited by TiTou on 12-17-2007 08:46 AM

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 2 of 4
(3,917 Views)

In the text you say that you want to remove everything that is a letter, leaving only numbers and dots, but your example leaves a pair of brackets () in too.

However both cases can be dealt with by using "Search and replace string" which you should right click and configure for regular expression.

Wire a true constant to "Replace all" and your input to "input string". Set the replace string to the empty string.

Now you need to set the search string to match everything you want to REMOVE

To remove everything that isn't a number, or a dot or a bracket use "[^\d.()]"

To remove all letters, keeping everything else, use "[A-Za-z]"

Foe full details, see the search and replace string help message, and follow the link to regular expressions.

Rod.

 

0 Kudos
Message 3 of 4
(3,884 Views)
Thank !
0 Kudos
Message 4 of 4
(3,881 Views)