Board index » cppbuilder » How to make first letter of a word uppercase..?

How to make first letter of a word uppercase..?


2004-05-20 08:34:48 AM
cppbuilder106
hi dear builders,
i want to make a first letter of a word uppercase..i use the below code
but something is wrong...it doesn't do nothing !
Can someone give me a hint on this...?
Oren
/************************************************/
Memo1->Text = Memo1->Text.LowerCase();
AnsiString str = Memo1->Text;
for(int i = 0; i < Memo1->Lines->Count; i++)
{
for(int y = 0; y < Memo1->Text.Length(); ++y)
{
if(str[y] == ' ') str[y + 1] = AnsiUpperCase(str[y + 1])[1];
}
}
Memo1->Text = str;
/************************************************/
 
 

Re:How to make first letter of a word uppercase..?

"Oren Halvani" < XXXX@XXXXX.COM >wrote in message
Quote
i want to make a first letter of a word uppercase..i use
the below code but something is wrong...it doesn't do
nothing !
Use something more like this code instead:
#include <ctype.h>
AnsiString str = Memo1->Text.LowerCase();
for(int i = 1; i <= str.Length(); ++i)
{
if( str[i] == ' ' )
{
if( i < str.Length() )
str[i+1] = (char) toupper(str[i+1]);
}
}
Memo1->Text = str;
Gambit
 

Re:How to make first letter of a word uppercase..?

thanks Remy..
 

{smallsort}