"JKop" <> wrote in message
news:nYPad.33245$...
> Robbo posted:
>
> > Hi, I need to know how to turn a string into Upper case letters even
> > if the input is in lower.
> >
> > E.g. say i was entering a name in a program and i typed john smith, i
> > need it to come out as John Smith.
> >
> > Any idea on how this is done?
> >
> > Many Thanks
> >
>
>
>>
> void ChangeToAllUppercase(char* const in_str)
> {
JKop: Umm, actually, that's not what was asked. Read it again: he wanted
to turn, for example, "john smith" into "John Smith". That requires using
toupper(), all right, but only on specific characters.
Robbo: I believe that the std::string class has member functions that will
locate specific delimiters, or at least to locate or return sub-strings in
the string using specific delimiters. Once you've located a specific
"token" (e.g., "smith"), simply call toupper() on the first character of
that. (And of course, just call toupper() on the very first character as
well.) Look into the string class members for more info. (I'm not up on
its member functions personally, sorry.)
If you have troubles with coding that, post what you accomplish and we can
help with specific problems with the code.
-Howard
|