Click here to Skip to main content
13,089,433 members (62,528 online)
Rate this:
Please Sign up or sign in to vote.
See more:

I need to check the substring in uppercase or lowercase in

THIS IS TESTING - No problem
this is testing - No problem
this IS TESTING - Problem (

here we found any uppercase need to convert to propercase.


Sivasankaran G
Posted 17-Jan-13 0:13am
Not clear. How "THIS IS TESTING" is not a problem? Formalize the requirements, please. What substring?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can make use of String.Compare with ignoreCase set to true.

You need to build in a parser that adheres to English grammar(assuming that's the only language you support) rules and then split string based on certain characters, for instance period (.) or a question mark and then change the case.

1. Extract first character and make it upper case.
2. Check for ., ?, ! etc. and next character after that(excluding space, if any) should be uppercase.
3. Are you dealing with abbreviation? If yes, have dictionary of predefined abbreviations and make sure they all are in uppercase.

Sivaguru88 17-Jan-13 6:27am
Thanks for your response, Need to compare with a single string

E.g a = "THIS is testing"

here we need to change only "THIS" to propercase no need to check "is testing"...

Output : This is testing
d@nish 17-Jan-13 6:37am
Updated the reply.
No. You never explained your criteria. Please understand that giving example does not mean define.
d@nish 17-Jan-13 7:28am
That's often the case here, isn't it? I just extrapolated that example as much I felt like.
Right, unfortunately. I prefer not answering in such cases. It's like development a wrong reflex. And I think being a human should be a required prerequisite. :-)
Sivaguru88 17-Jan-13 23:42pm
Hi all,
I Solved via linq

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170813.1 | Last Updated 17 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100