CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

search string in string

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
coconico



Joined: 31 Aug 2004
Posts: 7

View user's profile Send private message

search string in string
PostPosted: Tue Sep 07, 2004 6:22 am     Reply with quote

Question Question Question Question Question Question
Has any one a function that it search a string in an other string?

Thank you for helpping!
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Tue Sep 07, 2004 7:09 am     Reply with quote

Well how about the standard C function of strstr()?
Haplo



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

PostPosted: Tue Sep 07, 2004 11:15 pm     Reply with quote

As Mark pointed out, there is a standard C fucntion for this purpose called strstr(). In CCS, the code for strstr() is in the file STRING.H located in the \Drivers directory. Open it up and take a look at the source code. You can see:

Quote:

/* standard template:
char *strstr(const char *s1, const char *s2);
Locates first occurence of character sequence s2 in s1;
returns 0 if s2 is empty string

Uncomment #define FASTER_BUT_MORE_ROM at the top of the
file to use the faster algorithm */


Defining FASTER_BUT_MORE_ROM is indeed much faster especially if you need to work on big strings, but it results in a bigger code.

However, I remember having problems with the CCS strstr and writing my own. Still, the CCS code is a good starting point.
coconico



Joined: 31 Aug 2004
Posts: 7

View user's profile Send private message

PostPosted: Wed Sep 08, 2004 12:58 am     Reply with quote

Thank you very much. I don't saw this function.

Thank you for your help.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group