Put the first character of a string in uppercase

Started by Proskrito, Sat 31/05/2003 19:48:53

Previous topic - Next topic

Proskrito

I want to make a function that converts a string unformatted into one in lowercase but the first character in uppercase, like,if the string is:
"lOOk, a TRhEe heAded MonkEy", it would return:
"Look, a three headed monkey".
i thought of putting all in lowercase with "StrToLowerCase",
getting the first character with "StrGetCharAt", putting this character in uppercase and replace the first character with "StrSetCharAt".
BUT the main problem is that StrSetCharAt gets the character that have to replace the other as an integer, so i dont know if there is a way to do it.
Any ideas?


Dorcan

#1
function ChangeStrCase(string str){
   char S;
   StrToUpperCase(str);
   S=StrGetCharAt (str,0);
   StrToLowerCase(str);
   StrSetCharAt(str,0,S);
}

Scorpiorus

QuoteBUT the main problem is that StrSetCharAt gets the character that have to replace the other as an integer, so i dont know if there is a way to do it.
Don't worry about. You can pass an integer representing a character.

-Cheers

SMF spam blocked by CleanTalk