LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

replace string

hi all

 i have a string and i want to replace all the zeros (numeric '0') at the end of the string to be removed meaning that  if the string has zeros at the end i juss simply want all them to be removed. for example  if the string is 'asds60dffa890sfaf000' then the output should be 'asds60dffa890sfaf' and if the input is only "12qwadfe00afer0adsf' then the output should be same as the input since it doesnt have any zeros at the end.

Regards
0 Kudos
Message 1 of 7
(3,793 Views)
This should do.
0 Kudos
Message 2 of 7
(3,786 Views)

Hi there

 

you can also use regular expressions. See attachment.

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
Message 3 of 7
(3,779 Views)
Much better than mine, i admit..Smiley Happy
0 Kudos
Message 4 of 7
(3,770 Views)

This site has helped me understand Regular Expressions.

 

The expression "0*$" means:

  • 0 = find a zero
  • * = repeat the previous item zero or more times
  • $ = match at the end of the string
Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 5 of 7
(3,739 Views)

Be careful with regexpr, because most each editors and IDEs have their own definition and syntax of regexpr.

 

To be on the safe side right click the "match pattern" function and open the LabVIEW help for details.

 

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 6 of 7
(3,731 Views)

thnx everyonr all the things have been very helpful

thnx a lot

Regards
0 Kudos
Message 7 of 7
(3,687 Views)