String Length (One Less)
#1

I've got no idea whats going on. for some reason the string is returning one less character than it should, I've got multiple 'stocks' that basically do the same thing for other things.


pawn Код:
stock RandomEx(min, max) // Used for getting RANDOM letters or numbers (using %c)
{
    return random(max - min) + min;
}

stock RandomString()
{
    new string[10];
    format(string, sizeof(string), "%c%c%c%c%c%c%c%c%c%c", RandomEx('A','Z'),RandomEx('A','Z'),RandomEx('A','Z'),RandomEx('A','Z'),RandomEx('A','Z'),RandomEx('A','Z'),RandomEx('A','Z'),RandomEx('A','Z'),RandomEx('A','Z'),RandomEx('A','Z'),RandomEx('A','Z'));
    return string; // returns 9 characters not 10.
}
Reply


Messages In This Thread
String Length (One Less) - by zT KiNgKoNg - 16.01.2015, 19:50
Re: String Length (One Less) - by Lynn - 16.01.2015, 19:54
Re: String Length (One Less) - by HazardouS - 16.01.2015, 20:01
Re: String Length (One Less) - by zT KiNgKoNg - 16.01.2015, 20:09

Forum Jump:


Users browsing this thread: 1 Guest(s)