Solved

How to compare CString with text ?

Posted on 2000-04-16
2
184 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

752 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