How to get 00:00:00 into Hours=00 Mins=00 Secs=00 ?
#6

Use this:

pawn Код:
stock bool:Split(const string[], strdest[][], destsize = sizeof(strdest), separator = 32)
{
new lenght = strlen(string);
new index;
if(!lenght || !destsize || !separator) return false;
for(new i; i<destsize; i++)
{
while(index < lenght && string[index] == separator) index++;
new offset = index;
if(i < destsize - 1) while(index < lenght && string[index] != separator) strdest[i][index - offset] = string[index], index++;
else while(index <= lenght) strdest[i][index - offset] = string[index], index++;
strdest[i][index - offset] = 0;
}
return true;
}
How?

pawn Код:
new Time[] = "21:07:35";
new SplitTime[3][2];
Split(Time, SplitTime, sizeof(SplitTime), ':');
for(new i; i<3; i++) if(SplitTime[i][0] == '0') strdel(SplitTime[i], 0, 1);
Now you have values in variable "SplitTime". You can get them using strval.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 7 Guest(s)