stock Times_String_Repeated( strSrc[], strWhat[], bool:casesensitive = true)
{
new Times = 0, pos = -1;
while((pos = strfind(strSrc, strWhat, casesensitive, (pos + 1))) != -1) Times ++;
return Times;
}
stock getDigits(const value, strDig[]) //by RyDeR`
{
valstr(strDig, value, true);
for(new i; strDig{i} != EOS; ++i) strDig{i} -= '0';
}
stock explode(const sSource[], aExplode[][], const sDelimiter[] = " ", iVertices = sizeof aExplode, iLength = sizeof aExplode[])//not by me
{
new iNode, iPointer, iPrevious = -1, iDelimiter = strlen(sDelimiter);
while(iNode < iVertices)
{
iPointer = strfind(sSource, sDelimiter, false, iPointer);
if(iPointer == -1)
{
strmid(aExplode[iNode], sSource, iPrevious, strlen(sSource), iLength);
break;
}
else strmid(aExplode[iNode], sSource, iPrevious, iPointer, iLength);
iPrevious = (iPointer += iDelimiter);
++iNode;
}
return iPrevious;
}
stock SplitEx(strsrc[], strdest[][], delimiter) // Credits to original author
{
new i, li, aNum, len;
while(i <= strlen(strsrc))
{
if(strsrc[i] == delimiter || i == strlen(strsrc))
{
len = strmid(strdest[aNum], strsrc, li, i, 92);
strdest[aNum][len] = 0;
li = i + 1;
aNum++;
}
i++;
}
return 1;
}
stock StripStringOfNonNumbers(string[], const ichar[] = "", const size = sizeof ichar)
{
new c, i, j, idx, length = strlen(string);
for( ; i != length; ++i) {
c = string[i];
if('0' <= c <= '9') string[idx++] = c;
else {
for(j = size - 1; j != -1; --j) {
if(c == ichar[j]) {
string[idx++] = c;
break;
}
}
}
}
string[idx] = EOS;
return false;
}
stock bool:str_in_array(const sNeedle[], const aHaystack[][], const iHaystack = sizeof aHaystack)//by westie
{
new iNode = 0;
while(iNode < iHaystack)
{
if(!strcmp(sNeedle, aHaystack[iNode], true)) return true;
++iNode;
}
return false;
}
stock PlayerInsert(text[], rchar = '%')
{
new length = strlen(text);
for(new a = 0; a < length; a++)
{
if(text[a] == rchar && IsCharNumeric(text[a+1]) && text[a+1] != EOS)
{
if(IsPlayerConnected(strval(text[a+1])))
{
strdel(text[a], 0, 2);
strins(text[a], Playername(strval(text[a+1])), 0);
}
}
}
}