28.01.2011, 10:33
Quote:
|
I don't understand why you guys repost the corrected code by me over and over with different ways of spacing, tabbing. What's the point of this?
For me the code without { } looks ugly. That's how I am. I don't care how anyone else is feeling about this. |
Tab-spacing is very useful for reading your own code and organizing it, but this isn't a fashion contest, it's quite the inverse.
__________________________________________________ _________________________________________
Count the amount of control characters in a string.
Use this function to count the amount of control characters found in a string (null-terminators exempt), by specifying the character type and the string name.
Usage: countControlCharacters('r', "\rfffff\r");
Returns amount of characters found with the specified type.
pawn Код:
stock countControlCharacters(character, inSz[]) {
new
ccCount;
switch(character) {
case 'n': {
for(new it = 0; it < strlen(inSz); it++) {
if(inSz[it] == '\n') ccCount++;
}
}
case 'r': {
for(new it = 0; it < strlen(inSz); it++) {
if(inSz[it] == '\r') ccCount++;
}
}
case 't': {
for(new it = 0; it < strlen(inSz); it++) {
if(inSz[it] == '\t') ccCount++;
}
}
default: {
print("Critical error: Type undefined for countControlCharacters.");
}
}
return ccCount;
}


