Solved

How to compare CString with text ?

Posted on 2000-04-16
2
177 Views
Last Modified: 2013-11-20
hi,
 HOW do I compare a CString variable with a constant text say "HELLO".
The code is

CString& string =(CString) "text";
      if (ar.IsStoring())
      {
            // TODO: add storing code here
      }
      else
      {

            const CFile* fp = ar.GetFile();

            
        int      boolean = 1;

            while(boolean != NULL)
            
            {  
                 boolean = ar.ReadString(string);
                   if string == "HLAI"
                         a =1;
             else if string == "STIM"
                         b = 1;
                    
            else if string == "SI"
                        c = 1 ;
                        
0
Comment
Question by:mkjoshi
2 Comments
 
LVL 4

Accepted Solution

by:
inpras earned 30 total points
ID: 2720344
CString str;
str = "Some Text";

if (str.Find("HALLO") != -1)
{
//Hallo is present
}
else
{
//Hallo is not present
}

Use to upper or to lower for case insensitive
Hope this helps
inpras
0
 

Author Comment

by:mkjoshi
ID: 2721563
Adjusted points from 20 to 30
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

744 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

16 Experts available now in Live!

Get 1:1 Help Now