rk1960in Posted August 15, 2011 Report Share Posted August 15, 2011 I have a string with "\00\00\00\00\A6\00". Is there a build in function to remove "\00" or should the approach be using regular expressions? Trim white space function does not remove the bytes. Quote Link to comment
hooovahh Posted August 15, 2011 Report Share Posted August 15, 2011 I'm a little surprised the native Remove White space doesn't work. I also tried the OpenG remove white space and it didn't remove it. There's alot of over head but I think a simple solution would be to use the String to Byte Array, then use the OpenG Filter Array to remove any zeros, then use the byte array to string. EDIT: Sorry thought of an easier solution. Use the Search and Replace string, where you search for the 00 and replace with nothing. There is a boolean input to remove all, that needs to be set to true. Quote Link to comment
asbo Posted August 15, 2011 Report Share Posted August 15, 2011 The NULL character isn't white space, much less a printable character, which is why neither of those VIs did (or should) remove it. Search and Replace is a good way to do it, or if you know your data will always have 4 NULL characters prepended, you could use String Subset, which may garner a performance gain. Quote Link to comment
Bjarne Joergensen Posted August 15, 2011 Report Share Posted August 15, 2011 what about this Regards Bjarne Quote Link to comment
rk1960in Posted August 15, 2011 Author Report Share Posted August 15, 2011 Thanks - search and replace string worked:) @Bjarne : cant see ur attachment. @Bjarne - oh i see it now! @ Bjarne , yes this works too...thanks all! Quote Link to comment
asbo Posted August 24, 2011 Report Share Posted August 24, 2011 In a twist of fate, I was just bitten by this when I was pulling in a null-terminated string from a Windows API call. These can probably be combined into a single node using alternation, so your regex would be "^[\00]*|[\00]*$". Quote Link to comment
ShaunR Posted August 27, 2011 Report Share Posted August 27, 2011 Fast Trim rermoves null chars (non-printable) and not just whitespace. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.