|
-
August 22nd, 1999, 02:01 AM
#1
CString
Sir,
Lets suppose
CString temp="hellojshduahelloAIIHELLO";
Can I determine number of occurances of "hello" in the above "temp", how?.
Sajjad
-
August 22nd, 1999, 05:52 AM
#2
Re: CString
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
-
August 22nd, 1999, 06:42 AM
#3
Re: CString
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|