BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How do i convert chars string to AnsiString?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Language C++)
View previous topic :: View next topic  
Author Message
Ramy
Guest





PostPosted: Thu Mar 10, 2005 7:41 am    Post subject: How do i convert chars string to AnsiString? Reply with quote




Hi all, i know that the function c_str() convert Ansi-String to
chars string, What is the function that do the opposite?

Another question, if i have this string -

char MyString[50] = "abcdefg_ABCDEFG";

Is there one single function that can convert it to Upper-Case
string, like this -

"ABCDEFG_ABCDEFG" ?

Thanks,
Ramy

Back to top
Graham Thompson
Guest





PostPosted: Thu Mar 10, 2005 7:58 am    Post subject: Re: How do i convert chars string to AnsiString? Reply with quote



Just use the AnsiString constructor. Then, the UpperCase() method can be
used to change the case, but note: UpperCase() returns a new, upper-case
version of the string you call the method on. It doesn't change the string
you call the method on.

For example:

char MyString[50] = "abcdefg_ABCDEFG";
AnsiString asMyString(MyString);
AnsiString asMyUpperString = asMyString.UpperCase();

or

AnsiString asMyString("abcdefg_ABCDEFG");
AnsiString asMyUpperString = asMyString.UpperCase();

or

AnsiString asMyUpperstring = AnsiString("abcdefg_ABCDEFG").UpperCase();

or

AnsiString asMyUpperstring(AnsiString("abcdefg_ABCDEFG").UpperCase());

depending on what you want to achieve and what you need to have a copy of.

"Ramy" <Ramy (AT) NoMail (DOT) com> wrote

:
: Hi all, i know that the function c_str() convert Ansi-String to
: chars string, What is the function that do the opposite?
:
: Another question, if i have this string -
:
: char MyString[50] = "abcdefg_ABCDEFG";
:
: Is there one single function that can convert it to Upper-Case
: string, like this -
:
: "ABCDEFG_ABCDEFG" ?
:
: Thanks,
: Ramy
:


Back to top
Ramy
Guest





PostPosted: Thu Mar 10, 2005 9:09 am    Post subject: Re: How do i convert chars string to AnsiString? Reply with quote




Thanks, it's working and i can use it, but isn't it possible to
change the string to Upper-Case directly on the original chars
string without having to convert it to Ansi-String first?

Ramy


"Graham Thompson" <gct (AT) faGUESS-WHAT-TO-DO-WITH-THISsl (DOT) co.uk> wrote:
Quote:
Just use the AnsiString constructor. Then, the UpperCase() method can be
used to change the case, but note: UpperCase() returns a new, upper-case
version of the string you call the method on. It doesn't change the string
you call the method on.

For example:

char MyString[50] = "abcdefg_ABCDEFG";
AnsiString asMyString(MyString);
AnsiString asMyUpperString = asMyString.UpperCase();

or

AnsiString asMyString("abcdefg_ABCDEFG");
AnsiString asMyUpperString = asMyString.UpperCase();

or

AnsiString asMyUpperstring = AnsiString("abcdefg_ABCDEFG").UpperCase();

or

AnsiString asMyUpperstring(AnsiString("abcdefg_ABCDEFG").UpperCase());

depending on what you want to achieve and what you need to have a copy of.

"Ramy" <Ramy (AT) NoMail (DOT) com> wrote in message
news:422ffa3f$1 (AT) newsgroups (DOT) borland.com...
:
: Hi all, i know that the function c_str() convert Ansi-String to
: chars string, What is the function that do the opposite?
:
: Another question, if i have this string -
:
: char MyString[50] = "abcdefg_ABCDEFG";
:
: Is there one single function that can convert it to Upper-Case
: string, like this -
:
: "ABCDEFG_ABCDEFG" ?
:
: Thanks,
: Ramy


Back to top
Hans Galema
Guest





PostPosted: Thu Mar 10, 2005 9:54 am    Post subject: Re: How do i convert chars string to AnsiString? Reply with quote

Ramy wrote:
Quote:
Thanks, it's working and i can use it, but isn't it possible to
change the string to Upper-Case directly on the original chars
string without having to convert it to Ansi-String first?

#include <string.h>

char line [] = "1abDcfghijklm456kl";

strupr ( line );

Why such a misleading subject ?

Hans.

Back to top
Ramy
Guest





PostPosted: Thu Mar 10, 2005 10:35 am    Post subject: Re: How do i convert chars string to AnsiString? Reply with quote


Thanks very much Hans, it's much better!

Ramy


Quote:
#include
char line [] = "1abDcfghijklm456kl";

strupr ( line );

Why such a misleading subject ?

Hans.


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Language C++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.