08-01-2016 12:03 PM - edited 08-01-2016 12:06 PM
Hello,
I am using LabVIEW 2013. I am receiving messages from a robot via sockets. Attached is the text file for the message format from the robot. I am trying to search for certain characters in the string (¿® ), but the search and string function doesn't seem to be finding them, even though I can clearly see it's in the input string. Attached is a snippet VI of my code. According to the LV help, "If the replace string is empty, results string contains input string with search string deleted." So that's why it's in my code. You'll have to copy the text and paste it in there and just take out what you are searching for (in my case: ¿® ).
If someone could please tell me what I am doing wrong or explain to me why it isn't working like I thought it should, I would greatly appreciate the help!
SM
08-01-2016 12:17 PM - edited 08-01-2016 12:17 PM
I don't see where you have those two characters in your text file.
Try attaching your VI with your input string and search string containing the data, and save those values as default before you save your VI and post it.
08-01-2016 12:21 PM - edited 08-01-2016 12:23 PM
Hi SteMob,
SearchAndReplace does find your search string - when you set the parameters correctly:
Handling "unusual" chars is made easy by choosing a proper display mode for your strings! 😄
@RavensFan:
It seems you use a "too simple" ASCII code page. The mentioned chars are there right after the first asterisk…
08-01-2016 12:22 PM
Attached is the updated VI with the values stored.
Thanks,
SM
08-01-2016 12:29 PM
@GerdW wrote:
It seems you use a "too simple" ASCII code page. The mentioned chars are there right after the first asterisk…
I clicked on the file and it opened up in another browser window. I copy and pasted it from there. Apparently that changed those particular bytes to something else.
That is why I asked for the real data to be saved in the VI.
08-01-2016 12:31 PM - edited 08-01-2016 12:36 PM
It worked for me, please see attached image.
Okay, first it didn't work then i copieed text in notepad and it worked.
-There's an extra space after search string, correct it to two spaces and it works.
08-01-2016 12:33 PM
The problem is your search string contains hex bytes FABE 0000 (two null characters)
Clean it up to FABE.
Set your strings to either \codes or hex display so you can more easily see what odd characters or non-printing characters are there in those strings.
08-01-2016 12:35 PM
For some reason the format changed slightly between us. Attached is a screenshot of what the string actually is. Mine has spaces and another weird character instead of rectangles like Gerd's has...
08-01-2016 12:40 PM
REPLY to: The problem is your search string contains hex bytes FABE 0000 (two null characters)
Clean it up to FABE.
Raven,
I can't change the search string, that is what is coming off of some other stuff that can't be changed... And my HEX shows BFAE 0000?
Thanks,
SM
08-01-2016 12:46 PM - edited 08-01-2016 12:50 PM
Change the search string in your VI, not wherever else.
You are searching for BFAE 0000. that does not exist in your input string which goes BFAE 2020. You've got 2 spaces there in your input string right after BFAE, but are looking for 2 null characters.
EDIT: I scrambled up the hex characters when typing them. But the heart of the message still applies.