11-24-2009 12:35 PM
In my application, I'm sending around true binary data in strings and flattened data structures and sometimes I get null characters in the string. I was wonder if there is a way to dectect NULL characters in a string. Thanks for your help.
Josh
Solved! Go to Solution.
11-24-2009 12:42 PM
Josh,
A null character is hex 00. If you use Match pattern and make the search string a null, it should find it. To enter a null set the control or constant to '\ Codes' display and type in 00.
Another way is to convert the string to an array of U8 and search the array for 0.
Lynn
11-24-2009 12:45 PM
E=McHammered wrote:In my application, I'm sending around true binary data in strings and flattened data structures and sometimes I get null characters in the string. I was wonder if there is a way to dectect NULL characters in a string. Thanks for your help.
Josh
There are various ways to do that:
1) convert the string into a byte array and look for 0 bytes in there.
2) Using Match Pattern function and a search string containing \00 (enable backslash codes in the popup menu)
3) If it is about replacing/removing them, using the Search and Replace String function and again \00 as search string
4) - 99) various variants and functions in LabVIEW using advanced regualr expressions etc.