Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to compare CString with text ?

Posted on 2000-04-16
2
Medium Priority
?
187 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 120 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

705 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