'_' replace with ' '
#1

Problem was fixed.

-- This post is too old!
Reply
#2

Try

pawn Код:
stock strreplace(string[], find, replace)
{
    for(new i=0; string[i]; i++)
    {
        if(string[i] == find) string[i] = replace;  
    }
    return string;
}
Reply
#3

You may be looping it wrong,

its:

pawn Код:
for(new i = 0; i<strlen(string); i++)
Also, why stock? you're writing this for your mode right? why not use a public function?
Reply
#4

Quote:
Originally Posted by DobbysGamertag
Посмотреть сообщение
You may be looping it wrong,

its:

pawn Код:
for(new i = 0; i<strlen(string); i++)
Also, why stock? you're writing this for your mode right? why not use a public function?
Why write a public function?
Reply
#5

Код:
strreplace2(string[], const find[], const replace[], bool:ignorecase=true, count=cellmax, maxlength=sizeof(string))
{
    if(isnull(find) || isnull(string)) return 0;
    new matches;
    for(new idx, flen = strlen(find), rlen = strlen(replace), pos = strfind(string, find, ignorecase); pos != -1 && idx < maxlength && matches < count; pos = strfind(string, find, ignorecase, idx)) {
        strdel(string, pos, pos + flen);
        if(rlen) strins(string, replace, pos, maxlength);
        idx = pos + rlen;
        matches++;
    }
    return matches;
}
Reply
#6

Quote:
Originally Posted by TakeiT
Посмотреть сообщение
Why write a public function?
why use the "stock" word when you can use public. Go check out the pawn language pdf. Or SAMP Wiki explains it well.


https://sampwiki.blast.hk/wiki/Stocks


You're writing a stock, which will be used. Correct? You're using it incorrectly (my opinion)
Reply
#7

Alright.. Thx.. I understood.
Reply
#8

Quote:
Originally Posted by DobbysGamertag
Посмотреть сообщение
why use the "stock" word when you can use public. Go check out the pawn language pdf. Or SAMP Wiki explains it well.


https://sampwiki.blast.hk/wiki/Stocks


You're writing a stock, which will be used. Correct? You're using it incorrectly (my opinion)
Lol, why use public when you can use stock? Why use stock when you can use function? Why use either when simply writing the function works too?

pawn Код:
stock Myfunction()
pawn Код:
public Myfunction()
pawn Код:
function Myfunction()
pawn Код:
Myfunction()
All work the exact same.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)