05-19-2011 10:51 AM
Hi Folks,
Can you help me on getting the string out from (Send message “15 E 1 0 0 80 80 80 80 0 0 0 0 FF 0” to sim module)....?
I want to extract 15 E 1 0 0 80 80 80 80 0 0 0 0 FF 0 using Scan From String function. By the way, let me know, if there is any efficient method than using Scan From String function.
Thanks
Solved! Go to Solution.
05-19-2011 11:15 AM
Do you simply want to remove the double quotes or are you looking to extract the numbers? If you simply want to remove the double quotes here is a VI that will do that.
05-19-2011 11:23 AM
Thanks for helping me. I want to extract the Hex values those are inside the quote.
Input String = Send message “15 E 1 0 0 80 80 80 80 0 0 0 0 FF 0” to sim module
Expecting O/p = 15 E 1 0 0 80 80 80 80 0 0 0 0 FF 0
Appreciate your help. 🙂
Thanks
05-19-2011 11:30 AM
Perhaps the code I posted here would be useful.
05-19-2011 12:15 PM
You can use Scan from string with the following format specifier:
the number of %x must match the number of hex values in the input string. If the value is not constant consider using a regular expression to extract the data. %[^"] will match any string characters up to the first double quote. The double quote in the format specifier must be the same as the one in the input string (I changed it in the example code).
Ben64
05-19-2011 12:51 PM
@ben64 wrote:
You can use Scan from string with the following format specifier:
the number of %x must match the number of hex values in the input string. If the value is not constant consider using a regular expression to extract the data. %[^"] will match any string characters up to the first double quote. The double quote in the format specifier must be the same as the one in the input string (I changed it in the example code).
Ben64
The one downside of this approach is that your input string must always a particular size. If your data can vary in the number of hex numbers you will get a more generallized solution using a loop will be required. This is essentially what the link that I posted earlier does.
05-19-2011 12:59 PM
Thanks for the help. If you look at closely, input string have quotes like this “13 E 1 8 0 80 FE 80 80 0 0 0 0 FF 0”. Those quotes are quite different from this one ". I think, i may have to use these quotes as per the input string.
Thanks for all the responses.
05-19-2011 01:38 PM
Yes, the quotes you have are different but the various solutions posted will work as long as you include the correct character(s) in the regular expression or scan from string format specifier.
05-19-2011 01:48 PM
Thanks to Mark & Ben for the responses.
08-15-2023 10:38 AM
I was checking 'Unquote String (DQ).vi'. It has some limitations.
Look at the results:
Thanks.