Question on string

Hi there,

          Suppose there is a string,
"Brandon (living in USA)" My question is how can I compare with the string in bracket? My condition statement will look something like this....
if(str = "(living in USA)")
   usa = true;

For ur info. I'm using MSVC 5.0 and working on a win98 platform.

Any help offered is very much appreciated!!!
justinngAsked:
Who is Participating?
 
chensuConnect With a Mentor Commented:
If I understand your question correctly, you are comparing the substrings. You can use CString::Find to do so. For example,

CString str = _T("Brandon (living in USA)");

if (str.Find(_T("(living in USA)")) != ¨C1)
    usa = true;
0
 
rwilson032697Commented:
Look at the help for the strcmp* functions (or CString class if its a CString). One of these locate a substring in another string.

Cheers,

Raymond.
0
 
justinngAuthor Commented:
I've checked out the CString class but I'm still unable to identify the right function to use if I want to compare a substring with a string. Note that I'm comparing a CString and a string... so I dunno if I need to convert them to the same type.... please help!

Thanks!
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
justinngAuthor Commented:
what is the 2 dots on the left of C1 ??
0
 
justinngAuthor Commented:
What is C1 by the way?
0
 
justinngAuthor Commented:
Hey! Thanks... I got it!!! heheee....
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.