Sir,
Lets suppose
CString temp="hellojshduahelloAIIHELLO";
Can I determine number of occurances of "hello" in the above "temp", how?.
Sajjad
Printable View
Sir,
Lets suppose
CString temp="hellojshduahelloAIIHELLO";
Can I determine number of occurances of "hello" in the above "temp", how?.
Sajjad
CString temp="hellojshduahelloAIIHELLO";
CString junk = temp;
junk.MakeUpper();
int index = junk.Find("HELLO");
int count = 0;
while(index >= 0)
{
count++;
junk = junk.Right(junk.GetLength() - (index + 5));
index = junk.Find("HELLO");
}
//count is the number of occurrences, case insensituve
Thanks for your response, your solution works very fine.
Sir I have a simple problem left.
What I am using is to search a string "%%Pages:" in a file. I am using "fread()" to get the file contents and put the wole file in the "CString temp". Now
what follows after "%%Pages:" is an integer i.e "%%Pages: 6". Can we get this integer from the temp.
Sincerely
sajjad