/*indexOfPlus(sousChaîne, indexDebut) //alpach@alpach.net - www.alpach.net //recherche la sous chaîne spécifié et renvoi la position du premier caractere de celle ci //et ce uniquement si la sous chaine n'est pas un morceau d'un autre mot(voir l'exemple) //pourquoi indexOfPlus? -> http://www.flashxpress.net/forum/showthread.php?s=&threadid=29623 */ String.prototype.indexOfPlus = function(pMsC, pIdeb) { var iDebSc = this.indexOf(pMsC, pIdeb); if(iDebSc==-1){ return -1; } var lmSc = pMsC.length; var iDm = this.charCodeAt(iDebSc-1); var iDp = this.charCodeAt(iDebSc+lmSc); if (((iDebSc-1)<0 || ((iDm<65 || iDm>90) && (iDm<97 || iDm>122))) && ((iDebSc+lmSc)>=this.length || ((iDp<65 || iDp>90) && (iDp<97 || iDp>122)))) { return iDebSc; } else { return this.indexOfPlus(pMsC, iDebSc+lmSc); } }; ASSetPropFlags(String.prototype,"indexOfPlus",1); /*exemple: //dans 'maChaine': "bon" composant "bonheur" est ignoré //maChaine = "ho bonheur c'est bon!"; //trace(maChaine.indexOfPlus("bon", 0)); */