Converting to lower case errors - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Converting to lower case errors (
/showthread.php?tid=672150)
Converting to lower case errors -
Davi52 - 29.01.2020
Hey, I have some errors and warnings regarding to this function:
Code:
21: CorrectCaps(const string[],dest[]="",len=0)
22: {
23: for(new i=1;i<strlen(string);i++)
24: if(string[i]>64 && string[i]<94)
25: string[i]+=32;
26: dest[0]=EOS;
27: strcat(dest,string,len);
28: return string;
29: }
The errors:
Code:
(25) : error 022: must be lvalue (non-constant)
(25) : warning 217: loose indentation
(25) : error 017: undefined symbol "i"
(25) : warning 215: expression has no effect
(26) : warning 217: loose indentation
Re: Converting to lower case errors -
Proxus - 29.01.2020
Quote:
Originally Posted by Davi52
Hey, I have some errors and warnings regarding to this function:
Code:
21: CorrectCaps(const string[],dest[]="",len=0)
22: {
23: for(new i=1;i<strlen(string);i++)
24: if(string[i]>64 && string[i]<94)
25: string[i]+=32;
26: dest[0]=EOS;
27: strcat(dest,string,len);
28: return string;
29: }
The errors:
Code:
(25) : error 022: must be lvalue (non-constant)
(25) : warning 217: loose indentation
(25) : error 017: undefined symbol "i"
(25) : warning 215: expression has no effect
(26) : warning 217: loose indentation
|
Possibly something to do with on this line:
Code:
CorrectCaps(const string[],dest[]="",len=0)
Perhaps it should be like this?:
Code:
CorrectCaps(const string[],dest[],len=0)
Re: Converting to lower case errors -
Calisthenics - 29.01.2020
You modify `string` so it cannot be a
const array. Also functions may not return arrays of unknown size. Last, you can store what `strlen` returns in a variable to avoid calling the function over and over again.
Re: Converting to lower case errors -
Joe Staff - 29.01.2020
Is there not a "tolower" method that you can call?
Re: Converting to lower case errors -
Kwarde - 29.01.2020
Just wondering if you know this function or not. If you do, ignore this message. If you don't:
https://sampwiki.blast.hk/wiki/tolower