Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
HI
 
I need to check the substring in uppercase or lowercase in vb.net
 
e.g
THIS IS TESTING - No problem
this is testing - No problem
this IS TESTING - Problem (
 
here we found any uppercase need to convert to propercase.
 

Thanks
 
Sivasankaran G
Posted 17-Jan-13 0:13am
Comments
Sergey Alexandrovich Kryukov at 17-Jan-13 7:25am
   
Not clear. How "THIS IS TESTING" is not a problem? Formalize the requirements, please. What substring?
—SA

1 solution

Rate this: bad
good
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.
 
HTH
  Permalink  
v2
Comments
Sivaguru88 at 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 at 17-Jan-13 6:37am
   
Updated the reply.
Sergey Alexandrovich Kryukov at 17-Jan-13 7:26am
   
No. You never explained your criteria. Please understand that giving example does not mean define.
—SA
d@nish at 17-Jan-13 7:28am
   
That's often the case here, isn't it? I just extrapolated that example as much I felt like.
Sergey Alexandrovich Kryukov at 17-Jan-13 7:35am
   
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. :-)
—SA
Sivaguru88 at 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
0 Richard MacCutchan 335
1 OriginalGriff 310
2 Sergey Alexandrovich Kryukov 207
3 Sharmanuj 146
4 Magic Wonder 129
0 Sergey Alexandrovich Kryukov 5,999
1 OriginalGriff 5,115
2 CPallini 2,473
3 Richard MacCutchan 1,597
4 Abhinav S 1,505


Advertise | Privacy | Mobile
Web04 | 2.8.140814.1 | Last Updated 17 Jan 2013
Copyright © CodeProject, 1999-2014
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