string (stream) stuff function

Discussion in 'C++' started by dave, Jul 6, 2005.

  1. dave

    dave Guest

    hi im looking for a down n dirty blazing fast stuff function
    or sample how to write one my self
    for example:
    newstring=stuff(origstring,nstart,chrsdel,newinsert)
    1. orgstring is the original for instance a page from a document
    2 beginning position
    3. how many chars to delete
    4. string,chars to insert at Nstart point

    thanks for all the help
    dave
     
    dave, Jul 6, 2005
    #1
    1. Advertising

  2. dave

    Geo Guest

    It was blazingly fast to write...

    std::string f(const std::string &o, const std::string &n, int insert,
    int del)
    {
    return
    std::string(o,0,insert)+n+std::string(o,insert+del,std::string::npos);
    }
     
    Geo, Jul 6, 2005
    #2
    1. Advertising

  3. dave

    Geo Guest

    Sorry, didn't mean to top post... Google blah, blah, blah....
     
    Geo, Jul 6, 2005
    #3
  4. dave

    Geo Guest

    Geo wrote:
    > Sorry, didn't mean to top post... Google blah, blah, blah....


    !!!! oh I didn't, what's going on here, why won't they let me use a
    proper news reader !!!!!
     
    Geo, Jul 6, 2005
    #4
  5. dave

    dave Guest

    thanks...im new to c/c++ slowly getting there...thanks for the help
    dave

    "Geo" <> wrote in message
    news:...
    > It was blazingly fast to write...
    >
    > std::string f(const std::string &o, const std::string &n, int insert,
    > int del)
    > {
    > return
    > std::string(o,0,insert)+n+std::string(o,insert+del,std::string::npos);
    > }
    >
     
    dave, Jul 6, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rasmusson, Lars
    Replies:
    1
    Views:
    783
    popov
    Apr 30, 2004
  2. Replies:
    9
    Views:
    675
    Alex Buell
    Apr 27, 2006
  3. Alexander Korsunsky

    get stream mode flags from an opened stream

    Alexander Korsunsky, Feb 17, 2007, in forum: C++
    Replies:
    1
    Views:
    477
    John Harrison
    Feb 17, 2007
  4. dolphin
    Replies:
    6
    Views:
    596
    Thomas Fritsch
    Mar 18, 2007
  5. mrstephengross
    Replies:
    3
    Views:
    420
    James Kanze
    May 10, 2007
Loading...

Share This Page