Get string

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
neo23Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
AxterConnect With a Mentor Commented:
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
 
AxterCommented:
Give an example of what exactly you're looking for.
0
 
AxterCommented:
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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
neo23Author Commented:
<here is a string>i want everything between</and here>

needs to be very fast
0
 
neo23Author Commented:
<style>
want everything that is between
</style>
0
 
nietodCommented:
Does anyone know if this accepted answer was posted as a comment or as an answer?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.