473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

string (stream) stuff function

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,newinser t)
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

Jul 23 '05 #1
4 1477
Geo
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);
}

Jul 23 '05 #2
Geo
Sorry, didn't mean to top post... Google blah, blah, blah....

Jul 23 '05 #3
Geo
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 !!!!!

Jul 23 '05 #4
thanks...im new to c/c++ slowly getting there...thanks for the help
dave

"Geo" <gg@remm.org> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
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);
}

Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: gnv | last post by:
Hi all, I am writing a cross-browser(i.e. 6 and netscape 7.1) javascript program to save an XML file to local file system. I have an xml string like below: var xmlStr = "<?xml version="1.0"...
51
by: Alan | last post by:
hi all, I want to define a constant length string, say 4 then in a function at some time, I want to set the string to a constant value, say a below is my code but it fails what is the correct...
11
by: juvenuts | last post by:
Hi, I'm a complete newbie to C, but I wanted to get started by writing a few simple programs that print out strings. 1. The first thing I wanted to do was write a program that uses getchar to...
6
by: fnoppie | last post by:
Hi, I am near to desperation as I have a million things to get a solution for my problem. I have to post a multipart message to a url that consists of a xml file and an binary file (pdf)....
9
by: jl_post | last post by:
Hi, A few months back I remember reading through C++ newsgroups trying to find a way to quickly convert a number to a C++ std::string. I often see code like: // Create a string that holds a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.