LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to extract from string

Solved!
Go to solution

I know I have done this in CVI before..

 

I just can't remember how I did it..  😠

 

(braindead today???!!!???)

 

Here goes:

 

Take a string:

 

"Mary had a little lamb"

 

FindPattern "little"

 

resulting string:  ""Mary had a lamb"

 

What I have works up to finding the pattern and it's location.

 

-sigh-

 

I know I'll kick myself because from what I recall, it's a very simple solution... I just can't think of it..

And I vaguely remember the function name that I used...

 

R

0 Kudos
Message 1 of 4
(3,868 Views)
Solution
Accepted by topic author Ray.R

You could give something like this a try:

 

 

char *tok = "little ", *p, *s = "Marry had a little lamb";

p = strstr(s, tok);
strcpy (p, p + strlen (tok));

 

NickB

National Instruments 

Message Edited by nickb on 02-16-2010 04:15 PM
Message Edited by nickb on 02-16-2010 04:17 PM
Message 2 of 4
(3,863 Views)

Thanks,

I should have mentionned that the token in this case is a backspace '\b' character.
The idea is to remove all backspace characters and the character preceding it.

R

Here's a sample of the data:

[Counting] erozurozefozerczeroberozurozefozerczerobNumber of test Errors: 0
0 Kudos
Message 3 of 4
(3,844 Views)
Got it working..  🙂
0 Kudos
Message 4 of 4
(3,840 Views)