Solved

Question on string

Posted on 1998-11-05
6
164 Views
Last Modified: 2013-11-20
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!!!
0
Comment
Question by:justinng
  • 4
6 Comments
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1324271
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
 

Author Comment

by:justinng
ID: 1324272
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
 
LVL 23

Accepted Solution

by:
chensu earned 20 total points
ID: 1324273
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:justinng
ID: 1324274
what is the 2 dots on the left of C1 ??
0
 

Author Comment

by:justinng
ID: 1324275
What is C1 by the way?
0
 

Author Comment

by:justinng
ID: 1324276
Hey! Thanks... I got it!!! heheee....
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Replacement selected text 2 58
substring method in java 1 98
zeroFront challenge 7 80
zeroMAx challenge 20 88
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

895 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now