Quesiton: things
#1

I have a question ,exist something that calculate the characters in a string?
for example i say

"Maria have apple"

are 5 +space+ 4 +space + 5 = 16 characters in this string is new string[17];
and my question is: is a thing that auto-calculate the number of char in a string?
Reply
#2

pawn Код:
stock Numchars(str[]) {
    new num;
    for(new i = 0, j = strlen(str); i != j; ++i) {
        if(' ' != str[i]) ++num;
    }
    return num;
}
Reply
#3

ok ths
Reply
#4

Or you can just use the native function strlen which Misiur used in his alternative Numchars function....
Reply
#5

Oh lawd, sorry OP, I thought you wanted count of real characters excluding spaces. Of course SuperViper is right, strlen is what you are looking for
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)