[DGD] find_in_str
    chris . 
    psych_mayo at hotmail.com
       
    Sun Jul  8 00:20:43 CEST 2007
    
    
  
This is a function i made for my auto object.  It allows you to search a 
string for instances of a substring.  It returns an array containing the 
locations in the string of the start point for each substring.  I welcome 
suggestions and mention of any bugs.
static int *find_in_str(string search, string str) {
	int i;
	string *exploded;
	exploded = explode(search+str+search,search);
	if(sizeof(exploded) > 1) {
		int charnum;
		int *output;
		charnum = 0;
		output = ({});
		for(i=0;i < sizeof(exploded)-1;i++) {
			charnum += strlen(exploded[i]);
			output += ({charnum});
			charnum += strlen(search);
			}
		if(sizeof(output) != 0)
			return output;
		}
	}
_________________________________________________________________
Don't get caught with egg on your face. Play Chicktionary!  
http://club.live.com/chicktionary.aspx?icid=chick_hotmailtextlink2
    
    
More information about the DGD
mailing list