-
how to convert a string's content into the uppercase.
Who knows how to convert a string's content into the uppercase?
thank you very much.
-
Re: how to convert a string's content into the uppercase.
"jwr001" <wji@uncc.edu> wrote:
>
>Who knows how to convert a string's content into the uppercase?
>
>thank you very much.
std::String = "aBx";
String.toupper();
or
String.ToUpper();
it was something like this.
-
Re: how to convert a string's content into the uppercase.
apply toupper() to each char in the string.
Danny
jwr001 wrote:
>
> Who knows how to convert a string's content into the uppercase?
>
> thank you very much.
-
Re: how to convert a string's content into the uppercase.
"jwr001" <wji@uncc.edu> wrote:
>
>Who knows how to convert a string's content into the uppercase?
>
>thank you very much.
This is for C program.
if you have character strings 'A','B','C',....'Z' and 'a','b','c',....'z'
the ASCII code for them are:-
'A' = 65 'a' = 97
'B' = 66 'b' = 98
. .
. .
. .
'Z' = 90 'z' = 122
the diffrence beteeen lowercase 'a' and upercase 'A' is delta
delta = 97 - 65 = 32
to conver from low to upp case:-
char x='a';
printf(" x= %d \n",x);
printf(" x= %d \n",x-32);
printf(" x= %c \n",x-32);
output is:-
x = 97
x = 65
x = 'A'
-
Re: how to convert a string's content into the uppercase.
Hi,
if you are using VC++ there is a cool solution for this problem.
//...
CString csUpper; // it will contain the string as uppercase
char* cs = "it in uppercase"; // text
csUpper = cs; // CString object now has your string
csUpper.MakeUpper(); // turning it as uppercase
printf("%s\n",csUpper); // showing it on the screen
//...
Note : Your project must support MFC
-
Re: how to convert a string's content into the uppercase.
"jwr001" <wji@uncc.edu> wrote:
>
>Who knows how to convert a string's content into the uppercase?
>
>thank you very much.
_strupr()
* Note: It will not work with a literal constant string without a strdup(),
use only with buffers.
-
Re: how to convert a string's content into the uppercase.
The answer to that is not as easy as you might guess. The first thing
we need to know is exactly what do you mean by "a string"?
A C++ std::string?
An MFC CString?
A C string (NUL terminated array of characters)?
After we decided that, then we need to know is we're deal with just
English, or do we have to consider other languages as well?
For each of those, the answer is quite different.
--
Truth,
James Curran
www.NJTheater.com (Professional)
www.NovelTheory.com (Personal)
www.BrandsForLess.Com (Day Job)
"jwr001" <wji@uncc.edu> wrote in message news:3bd4b8c8$1@news.devx.com...
>
> Who knows how to convert a string's content into the uppercase?
-
Re: how to convert a string's content into the uppercase.
"jwr001" <wji@uncc.edu> wrote:
>
>Who knows how to convert a string's content into the uppercase?
>
>thank you very much.
I found a nice case-insensitive strcmp somewhere, but I can`t remember where.
It was just some source code to put in your string.h file.
-
Re: how to convert a string's content into the uppercase.
"Prototype" <prototype@myself.com> wrote in message
news:3bd88b01$1@news.devx.com...
> I found a nice case-insensitive strcmp somewhere, but I can`t remember
where.
> It was just some source code to put in your string.h file.
>
There is no standard one, but most compilers offer one as an extension.
However, they can't agree on a name. Some use stricmp(), other use
strcmpi(), and still others use istrcmp().
--
Truth,
James Curran
www.NJTheater.com (Professional)
www.NovelTheory.com (Personal)
www.BrandsForLess.Com (Day Job)
-
Re: how to convert a string's content into the uppercase.
"James Curran" <JamesCurran@mvps.org> wrote:
>"Prototype" <prototype@myself.com> wrote in message
>news:3bd88b01$1@news.devx.com...
>
>> I found a nice case-insensitive strcmp somewhere, but I can`t remember
>where.
>> It was just some source code to put in your string.h file.
>>
>
> There is no standard one, but most compilers offer one as an extension.
>However, they can't agree on a name. Some use stricmp(), other use
>strcmpi(), and still others use istrcmp().
>
>--
>Truth,
>James Curran
>www.NJTheater.com (Professional)
>www.NovelTheory.com (Personal)
>www.BrandsForLess.Com (Day Job)
>
And leave us not forget... _tcsicmp(), _mbsicmp(), and _wcsicmp(). <g>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks