14.02.2013, 19:03
Quote:
Hi
pawn Code:
Usage: pawn Code:
pawn Code:
LetsOWN |
Shabi RoxX's direct replacement method should be the fastest and simplest I think. It has no limit on the input string size because it doesn't even need another string to store the output.
I also doubt "char" can be used as a variable/iterator as it's a reserved word. You can see the blue highlighting on it in your post.
Using strlen in the for loop check may also be slow for long strings (though the input string is short in this case). You should do something like
pawn Code:
for(new i = 0, len = strlen(string);i < len;i++)
pawn Code:
new String[12] = "aCAUiFIUA";
//or
new String[12];
String = "aCAUiFIUA";
Printing a single string can just use print(xToLower(String)).
Some may argue that we can't see the actual speed difference because the CPU is so fast, or they're just a little things that shouldn't be cared about too much, but at least it looks better and simpler, it's a good scripting practise.