?
Solved

Easiest approach to find the substring in a string ignoring it's case senistivity

Posted on 2004-11-09
4
Medium Priority
?
263 Views
Last Modified: 2013-11-20
Hello Guys,

We have CString.Find and CString.CompareNoCase to find the substring and Ignoring the case .

Now my Question is I wanted to find a substring in a string and the search should be case insensitive. How it is possible. Is there any method available for that?? Or what is simplest approach??

Thanks
Sudhakar

0
Comment
Question by:sudhakar_koundinya
  • 2
4 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 150 total points
ID: 12531576
Convert both string and substring using MakeUpper or MakeLower  and use Find with converted strings.
0
 
LVL 14

Author Comment

by:sudhakar_koundinya
ID: 12531621
Thought the same

But Don't want to loose the Actual String.

Only thing I can do is have a copy of original string and do the rest

Anyways thanks for your help


Regards
sudhakar
0
 
LVL 16

Expert Comment

by:nonubik
ID: 12531627
If you want to find only the position of such a case insensitive substring, you can: lower/upper the string and then find your substring

CString strToFind,strText;

strText.MakeUpper();
strToFind.MakeUpper();
strText.Find(strToFind);
0
 
LVL 14

Author Comment

by:sudhakar_koundinya
ID: 12531638
I thought there will be some method for this
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses

807 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