Posts: 734
Threads: 8
Joined: Jun 2009
This doesn't make any sense, why format two strings, and is "cPatente" a string, or an integer?
Posts: 101
Threads: 11
Joined: Jan 2013
Reputation:
0
Are numbers at the beginning or the end?
Posts: 65
Threads: 20
Joined: Jun 2014
Reputation:
0
The 'cPatente' is the number plate, Ex: "ASD123", the letters appears, but the numbers no, I used %d for only use the numbers with color
Posts: 734
Threads: 8
Joined: Jun 2009
You can use
strins() for this. Though there might be an optimised way of doing this by only looping through the string once and copying/modifying it at once. (I'm not sure about the "if" check though, seems alright to me)
pawn Код:
new insertAt = -1;
for (new i = 0; i < strlen(cInformacion[ID][cPatente]); i++)
{
if ('0' <= cInformacion[ID][cPatente][i] <= '9')
{
insertAt = i;
break;
}
}
new string[32];
strcpy(string, cInformacion[ID][cPatente], 32);
if (insertAt != -1)
strins(string, "{FF0000}", insertAt);
Posts: 734
Threads: 8
Joined: Jun 2009
Quote:
Originally Posted by Threshold
Why? 'format' is perfectly fine here...
|
It is, but nowhere did the OP state that he wishes to use random numbers after the text, then your function would be suited, but the way I see it, he has it predefined and saved as the plate text, and he only wanted to color the number part.
Depends on what the OP wants, but I do agree with you on this Threshold.