Kevin van Zonneveld on 2008-03-05 23:17:06
@ Alfonso Jiménez: Oh I should have seen that.. Anyway, I've updated the function and the test page gives the correct results now: http://kevin.vanzonneveld.net/pj_tester.php thanks again!
Alfonso Jiménez on 2008-03-05 21:23:09
Arggg I made an error in the last example! It's "is" instead of "mi" :) If you realize "mi" is not in the string "This is a Simple text". I'll try to develop another contribution soon :) Regards!
Kevin van Zonneveld on 2008-03-05 17:25:15
@ Alfonso Jiménez: Hi Alfonso, thanks for your second contribution & the example! Only one thing, the example produces: false instead of: 'is is a Simple text.' Maybe you can see what's going wrong? (btw, I had to add the '{' & '}' to make it compatible with the packer)
Alfonso Jiménez on 2008-03-05 09:49:22
BTW, Usage example:
strpbrk('This is a Simple text', 'mi')
Regards! Alfonso Jiménez (http://www.alfonsojimenez.com)
Alfonso Jiménez on 2008-03-05 09:45:56
Hey Kevin. My second contribution is here :)

function strpbrk(haystack, char_list) {
   var lon = haystack.length;
   var lon_search = char_list.length;
   var ret = false;
   var stack = '';

   if(lon >= lon_search) {
	if(lon == lon_search) {
	    if(haystack == char_list)
	       ret = haystack;
	} else {
	    j = 0;
	    i = 0;
	    while(i < lon_search && j < lon && !ret) {
    		if(char_list[i] == haystack[j]) {
		      i++;
		      if(i == lon_search) ret = true;
	  	}
		j++;
	    }

	     if(ret)
		for(i = (j-lon_search); i < lon; i++)
			stack += haystack[i];

			if(stack != '')
				ret = stack;
	     }
         }

	return ret;
}
Re