Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Re: placing new...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 8 Topic 45768 of 47006
Post > Topic >>

Re: placing new characters at the end of string

by pjb@[EMAIL PROTECTED] (Pascal J. Bourguignon) May 6, 2008 at 10:45 AM

"friend.blah@[EMAIL PROTECTED]
" <friend.blah@[EMAIL PROTECTED]
> writes:

> i have a string say
>
> string crap = "abc:abd:aass";
>
> at the end of my string i want to place new characters like "xx"
> so the final string looks like
>
> string crap = "abc:abd:aassxx";
>
> how to resolve this issue...
>
> i could able replace colons (:) with other characters but i am failing
> when i wanna place new characters at the end of string.
>
>
> thanks for any help


#include <string>
#include <iostream>
using namespace std;

int main(void){
    string a="abc";
    a.push_back('.');
    a+="def";
    a=a+".ghi";
    cout<<a<<endl;
    return(0);
}

/*
-*- mode: compilation; default-directory: "/tmp/" -*-
Compilation started at Tue May  6 10:44:39

 g++ -o a a.c++ && ./a
abc.def.ghi

Compilation finished at Tue May  6 10:44:39
 */


Have a look at:
http://www.cplusplus.com/reference/string/

-- 
__Pascal Bourguignon__
 




 8 Posts in Topic:
placing new characters at the end of string
"friend.blah@[EMAIL   2008-05-06 01:29:33 
Re: placing new characters at the end of string
Ian Collins <ian-news@  2008-05-06 20:32:14 
Re: placing new characters at the end of string
"friend.blah@[EMAIL   2008-05-06 01:35:05 
Re: placing new characters at the end of string
Ian Collins <ian-news@  2008-05-06 20:40:50 
Re: placing new characters at the end of string
"Andrew Koenig"  2008-05-09 03:44:10 
Re: placing new characters at the end of string
pjb@[EMAIL PROTECTED] (P  2008-05-06 10:45:22 
Re: placing new characters at the end of string
"Jim Langston"   2008-05-06 01:57:19 
Re: placing new characters at the end of string
James Kanze <james.kan  2008-05-06 03:17:14 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 1:58:14 CDT 2008.