| Topic: |
DEVELOP > c-Plus-Plus |
| User: |
"" |
| Date: |
28 Jan 2008 01:02:37 PM |
| Object: |
Working on long String in C++ |
Hi,
I have one long String like this:
015EnvironmentData1........
I want to read first three character from it and convert them to
integer. This will be the length of the Name of the field and then
there is value. So if we take above example
015 means 15 - So we are going to read next 15 Character Starting with
E of "EnvironmentData" till "a".
Transfer it to come Variable say Field
Then I have to read the Value of this field which is followed by this
15 character long Field in the STring that is 1 in the above case.
I need help in Stripping of the String so that I can get all the
Fields and their values.
This has to be in C++. I am new at it. Please help.
Thanks in advance
.
|
|
| User: "Victor Bazarov" |
|
| Title: Re: Working on long String in C++ |
28 Jan 2008 01:17:24 PM |
|
|
wrote:
I have one long String like this:
015EnvironmentData1........
I want to read first three character from it and convert them to
integer. This will be the length of the Name of the field and then
there is value. So if we take above example
015 means 15 - So we are going to read next 15 Character Starting with
E of "EnvironmentData" till "a".
Transfer it to come Variable say Field
Then I have to read the Value of this field which is followed by this
15 character long Field in the STring that is 1 in the above case.
I need help in Stripping of the String so that I can get all the
Fields and their values.
This has to be in C++. I am new at it. Please help.
Something like
std::string const blah("015EnvironmentData1........");
int n = -1;
std::ostringstream os(blah.substr(0, 3));
os >> n;
std::string Field = blah.substr(3, n);
os.str() = blah.substr(3 + n, 1);
int Value = -1;
os >> Value;
This is untested and only intended to give an idea.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
.
|
|
|
| User: "" |
|
| Title: Re: Working on long String in C++ |
28 Jan 2008 02:20:58 PM |
|
|
Hi Victor,
Thanks for reply.
This String is coming to the Parsing function in the form of pointer
to the string. Could you please advice something like the above
solution that will work with Pointer to String.
Thanks
.
|
|
|
| User: "Victor Bazarov" |
|
| Title: Re: Working on long String in C++ |
28 Jan 2008 02:27:42 PM |
|
|
wrote:
This String is coming to the Parsing function in the form of pointer
to the string. Could you please advice something like the above
solution that will work with Pointer to String.
std::string const blah(Pointer_To_String);
Everyting else is pretty much the same.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
.
|
|
|
| User: "" |
|
| Title: Re: Working on long String in C++ |
30 Jan 2008 04:22:06 PM |
|
|
On Jan 28, 3:27=A0pm, "Victor Bazarov" <v.Abaza...@comAcast.net> wrote:
manishshar...@gmail.com wrote:
This =A0String is coming to the Parsing function in the form of pointer
to the string. Could you please advice something like the above
solution that will work with Pointer to String.
=A0 =A0 std::string const blah(Pointer_To_String);
Everyting else is pretty much the same.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Hi Victor,
My code is Unicode and I have to use CstString. Please suggest some
solution related to that.
Thanks
.
|
|
|
| User: "peter koch" |
|
| Title: Re: Working on long String in C++ |
30 Jan 2008 05:14:21 PM |
|
|
On 30 Jan., 23:22, wrote:
On Jan 28, 3:27=A0pm, "Victor Bazarov" <v.Abaza...@comAcast.net> wrote:
wrote:
This =A0String is coming to the Parsing function in the form of pointe=
r
to the string. Could you please advice something like the above
solution that will work with Pointer to String.
=A0 =A0 std::string const blah(Pointer_To_String);
Everyting else is pretty much the same.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Hi Victor,
My code is Unicode and I have to use CstString. Please suggest some
solution related to that.
Ask somewhere where CstString is topical. This is not the place.
/Peter
.
|
|
|
| User: "" |
|
| Title: Re: Working on long String in C++ |
31 Jan 2008 07:49:32 AM |
|
|
I meant CStdString
.
|
|
|
| User: "Richard Herring" |
|
| Title: Re: Working on long String in C++ |
31 Jan 2008 09:22:06 AM |
|
|
In message
<ee6e9bf2-e744-4f50-9db3-36b124783f04@k2g2000hse.googlegroups.com>,
manishsharma1@gmail.com writes
[please quote some context in your posts]
I meant CStdString
Same answer.
--
Richard Herring
.
|
|
|
| User: "" |
|
| Title: Re: Working on long String in C++ |
31 Jan 2008 09:37:49 AM |
|
|
Can you suggest where to post it then. I am new to development world.
Thanks in Advance
.
|
|
|
| User: "peter koch" |
|
| Title: Re: Working on long String in C++ |
31 Jan 2008 09:45:14 AM |
|
|
On 31 Jan., 16:37, wrote:
Can you suggest where to post it then. I am new to development world.
Thanks in Advance
Hello
I am afraid I don't know. I suppose you know the name of the library/
development environment you use? In that case it should be a matter of
minutes before googling e.g. google newsgroups should provide you with
the name of an appropriate newsgroup.
/Peter
.
|
|
|
| User: "" |
|
| Title: Re: Working on long String in C++ |
31 Jan 2008 09:48:02 AM |
|
|
On Jan 31, 10:45=A0am, peter koch <peter.koch.lar...@gmail.com> wrote:
On 31 Jan., 16:37, wrote:
Can you suggest where to post it then. I am new to development world.
Thanks in Advance
Hello
I am afraid I don't know. I suppose you know the name of the library/
development environment you use? In that case it should be a matter of
minutes before googling e.g. google newsgroups should provide you with
the name of an appropriate newsgroup.
/Peter
Thanks.
.
|
|
|
| User: "Hans Mull" |
|
| Title: Re: Working on long String in C++ |
31 Jan 2008 10:25:30 AM |
|
|
schrieb:
On Jan 31, 10:45 am, peter koch <peter.koch.lar...@gmail.com> wrote:
On 31 Jan., 16:37, wrote:
Can you suggest where to post it then. I am new to development world.
Thanks in Advance
Hello
I am afraid I don't know. I suppose you know the name of the library/
development environment you use? In that case it should be a matter of
minutes before googling e.g. google newsgroups should provide you with
the name of an appropriate newsgroup.
/Peter
Thanks.
Are you German?
If yes, try
http://www.c-plusplus.de/forum/
Kind regards
.
|
|
|
| User: "Richard Herring" |
|
| Title: Re: Working on long String in C++ |
31 Jan 2008 11:00:42 AM |
|
|
In message <fnsspq$d3b$1@online.de>, Hans Mull
<deyringer@googlemail.com> writes
manishsharma1@gmail.com schrieb:
On Jan 31, 10:45 am, peter koch <peter.koch.lar...@gmail.com> wrote:
On 31 Jan., 16:37, wrote:
Can you suggest where to post it then. I am new to development world.
Thanks in Advance
Hello
I am afraid I don't know. I suppose you know the name of the library/
development environment you use? In that case it should be a matter of
minutes before googling e.g. google newsgroups should provide you with
the name of an appropriate newsgroup.
Thanks.
Are you German?
If yes, try
http://www.c-plusplus.de/forum/
Does the German C++ standard define a type called CStdString, or are
they just more tolerant of off-topicality there?
--
Richard Herring
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
Related Articles |
|
|