Showing results for 
Search instead for 
Did you mean: 

Equivalent for this code

Hi, Could you please let me know what is the EQUIVALENT for this code. This code replace 2 number of  0s or 1s to Just one 0 or 1. The code is very very slow when the input string is very big. Is there any way to replace it with something faster.


0 Kudos
Message 1 of 3

Can you provide some numbers? How many characters are in a "very big" string? How long does it take to be "very very slow" code?


How many replacements typically occur in your string?


Do your strings ever have anything which is not a 1 or zero?



0 Kudos
Message 2 of 3

This code takes 1ms to run on a string of 60,000 characters (one continuous string of 0's and 1's).  Whereas using your code, it takes about 900ms for the same string.


Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 3 of 3