02-17-2010 10:59 AM
Hello,
I would like to remove odd spaces from a hex string and output the result. This is what the input string will look like:
01 00 04 0F FF 36 3B CC...
I would like the output to be:
0100 040F FF36 3BCC...
I obtained the attached labview code from the forum earlier, however it doesn't work with text.
Any help is greately appreciated.
Thanks,
hiNi.
Solved! Go to Solution.
02-17-2010 11:31 AM - edited 02-17-2010 11:35 AM
Have I got it right?
02-17-2010 11:57 AM
Hi,
There is really no need to change the code that much.
The case structure is only looking for the characters 0-9 and A-F. It is clear that the case structure needs to be looking for a-f as well. The a-f condition in decimal format is 97-102 (what you need to add to the case structure condition), which is 61-66 in hex. You new condition would be 48..57, 65..70, 97-102. I have alos attached modified version of your original code.
02-17-2010 01:15 PM
Hello jyang72211,
Can you save your VI to labview 8.2. I cannot open up your VI to look at your code.
Thanks for your help and time.
hiNi
02-17-2010 01:41 PM
You may want to try out 'Search and Replace String'. The regex is ()_(), notice the space between them. No space in the replace string.
02-17-2010 02:15 PM
02-17-2010 02:28 PM - edited 02-17-2010 02:30 PM
Darin.K,
Must admit I'd have never thought to use this function to do this. Kind of warped my brain at first. Had no idea Search and Replace String could be this powerfull.
Unfortunately code didn't work when I tried it. Some sort of typo in the search string. I've attached two variations that do work.
02-17-2010 02:54 PM
Wayne.C wrote:
Unfortunately code didn't work when I tried it. Some sort of typo in the search string. I've attached two variations that do work.
On my iPhone now so no testing, but it did work just fine for me. As with all of these functions, the regex support varies, but there are a large variety of ones that work. I was playing a little, so hopefully between the experimenting/saving/snipping I didn't screw it up.
Glad to bend your mind, most of us only scratch the surface of the power of Regular Expressions.