This is the function I thought since I know strings.
I rarely mess with GE default functions, so I don't know this is already there or not...
Function to change letters into capital or lower mode.
Function (place this on Global code) :
- Code: Select all
char *ToUpper(char str[256])
{
int i,intc;
char *stru=malloc(256); //get memory allocation for the pointer
char tmp[2]; //just for the temporary string
for(i=0;i<strlen(str);i++)
{
intc=(int)str[i]; //get the ASCII number
if(intc>=97&&intc<=122)intc-=32; //if intc in range of small letters decrease it's ASCII number by 32
sprintf(tmp,"%s",&intc);
strcat(stru,tmp); //combine the letters
}
return stru;
}
char *ToLower(char str[256])
{
int i,intc;
char *strl=malloc(256); //get memory allocation for the pointer
char tmp[2];
for(i=0;i<strlen(str);i++)
{
intc=(int)str[i]; //get the ASCII number
if(intc>=65&&intc<=90)intc+=32; //if intc in range of capital letters increase it's ASCII number by 32
sprintf(tmp,"%s",&intc);
strcat(strl,tmp);
}
return strl;
}
Usage :
- Code: Select all
strcpy(text,ToUpper("Bee-ant, DST, Fuzzy"); //the output would be: "BEE-ANT, DST, FUZZY"
strcpy(text,ToLower("Bee-ant, DST, Fuzzy"); //the output would be: "bee-ant, dst, fuzzy"
Limitation :
- Since GE can only handle 256 string length, I just follow it...