 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Ramy Guest
|
Posted: Thu Mar 10, 2005 7:41 am Post subject: How do i convert chars string to AnsiString? |
|
|
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
|
Posted: Thu Mar 10, 2005 7:58 am Post subject: Re: How do i convert chars string to AnsiString? |
|
|
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
|
Posted: Thu Mar 10, 2005 9:09 am Post subject: Re: How do i convert chars string to AnsiString? |
|
|
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
|
Posted: Thu Mar 10, 2005 9:54 am Post subject: Re: How do i convert chars string to AnsiString? |
|
|
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
|
Posted: Thu Mar 10, 2005 10:35 am Post subject: Re: How do i convert chars string to AnsiString? |
|
|
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 |
|
 |
|
|
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
|
|