LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Extract either string1 or string2 from another string

I have a string of data named "dump" with 500 or more bytes of data that will contain within it either (along with other data)  the word "circle" or  the word "square". (but not both)

 

I need to pull which ever one of these two words that is in the string "dump" and to create a string called "type" that contains only  that word.

 

Is there an easy way to do this with a line of code or two?

 

thanks

0 Kudos
Message 1 of 2
(2,646 Views)

if (FindPattern (dump, 0, -1, "circle", 0, 0) >= 0)

   strcpy (typem "circle");

else if (FindPattern (dump, 0, -1, "square", 0, 0) >= 0)

   strcpy (type, "square");



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 2
(2,645 Views)