| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| coconico 
 
 
 Joined: 31 Aug 2004
 Posts: 7
 
 
 
			    
 
 | 
			
				| search string in string |  
				|  Posted: Tue Sep 07, 2004 6:22 am |   |  
				| 
 |  
				|             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
 
 
			      
 
 | 
			
				|  |  
				|  Posted: Tue Sep 07, 2004 7:09 am |   |  
				| 
 |  
				| Well how about the standard C function of strstr()? |  | 
	
		|  | 
	
		| Haplo 
 
 
 Joined: 06 Sep 2003
 Posts: 659
 Location: Sydney, Australia
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Tue Sep 07, 2004 11:15 pm |   |  
				| 
 |  
				| 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
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Wed Sep 08, 2004 12:58 am |   |  
				| 
 |  
				| Thank you very much. I don't saw this function. 
 Thank you for your help.
 |  | 
	
		|  | 
	
		|  |