06-15-2015 01:21 PM
Hello,
I am trying to put a space between every two characters in an input string. I only got the VI to work after the first 2 characters. Can you help me get the space after every two (2) characters?
Thanks,
hiNi
Solved! Go to Solution.
06-15-2015 01:34 PM
Your input looks suspiciously like a hexadecimal number. Are you sure you need to be passing around strings instead of numbers?
If you really do need to work with strings, why not keep it as strings instead of converting down to bytes?
06-15-2015 01:43 PM
Maybe this:
06-15-2015 01:51 PM
I was thinking more like this
There's an extra space at the end which can easily be deleted.
06-15-2015 01:59 PM
06-15-2015 02:40 PM
Using \V (not vertical whitespace) adds the spaces line by line and ignores the linefeeds.
06-18-2015 02:39 PM
You can get a little more performance (>10x?) if you don't use build array in a loop and avoid regex
06-18-2015 02:48 PM
@igagne wrote:
You can get a little more performance (>10x?) if you don't use build array in a loop and avoid regex
You will need to pad an extra space at the end of the original string is its lenght is odd.
Ben64
06-18-2015 02:58 PM
06-18-2015 07:37 PM - edited 06-18-2015 07:37 PM
Just to break the monotony, here's yet another possibility.... 😄
(of course tweaks might be needed if the number of input characters is not even or if the last space is unwanted, for example)