Solved

Get string

Posted on 2001-06-20
6
188 Views
Last Modified: 2010-04-02
This is what i need.

A way to get as string in between two other strings...

has to use cstring and has to be really fast..

thanx
0
Comment
Question by:neo23
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 30

Expert Comment

by:Axter
ID: 6210014
Give an example of what exactly you're looking for.
0
 
LVL 30

Expert Comment

by:Axter
ID: 6210044
CString data = "Hello Bob.  How are you?";
//First method
strncpy(data.LockBuffer()+6,"Tom",3);
data.UnlockBuffer();
//Second method
data.Replace("Tom", "Kay");
//Third method
strncpy(data.GetBuffer(10)+6,"Joe",3);

The above are a few method.  Not sure what exactly you need.  Please provide additional information.
0
 

Author Comment

by:neo23
ID: 6210477
<here is a string>i want everything between</and here>

needs to be very fast
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:neo23
ID: 6210487
<style>
want everything that is between
</style>
0
 
LVL 30

Accepted Solution

by:
Axter earned 50 total points
ID: 6210562
Example:
CString LeftKey = "<style>";
CString RightKey = "</style>";
CString szdata = "<style>want everything that is between</style><style>Want here again</style>";
CString szReplace = "Hello World";
int Start = 0;
while(szdata.Find(LeftKey,Start) > -1)
{
     Start = szdata.Find(LeftKey,Start);
     int End = szdata.Find(RightKey,Start);
     CString LeftSide = szdata.Left(Start+LeftKey.GetLength());
     CString RightKey = szdata.Mid(End);
     szdata = LeftSide + szReplace + RightKey;
     Start += LeftKey.GetLength();
}
0
 
LVL 22

Expert Comment

by:nietod
ID: 6222865
Does anyone know if this accepted answer was posted as a comment or as an answer?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question