PC Review


Reply
Thread Tools Rate Thread

Character case level question

 
 
Mika M
Guest
Posts: n/a
 
      27th Aug 2004
Hi!

How can I check which chars in String are UpperCase chars?

I mean for example string "aAbBc" has second and fourth character uppercase
characters, so I want to get this information somehow. I'm using VB .NET
2003, but understand C# also quite well.

--
Thanks in advance!

Mika


 
Reply With Quote
 
 
 
 
_IS_ -
Guest
Posts: n/a
 
      27th Aug 2004

like this :

Dim c As Char

For Each c In TextBox1.Text
If UCase(c) = c Then
MsgBox(c & " is uppercase")
Else
MsgBox(c & " is lowercase")
End If
Next

then i suppose instead of "MsgBox(c & " is uppercase")"
you would fill an array of chars that are returned as UCase


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
One Handed Man \( OHM - Terry Burns \)
Guest
Posts: n/a
 
      27th Aug 2004
Dim str As String = "aBc"
Dim ch As Char
Dim ContainsUppers As Boolean = False

For Each ch In str.ToCharArray

If ch = Char.ToUpper(ch) Then
ContainsUppers = True
Exit For
End If

Next



--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing

"Mika M" <mika.mahonen@nospam_kolumbus.fi> wrote in message
news:(E-Mail Removed)...
> Hi!
>
> How can I check which chars in String are UpperCase chars?
>
> I mean for example string "aAbBc" has second and fourth character

uppercase
> characters, so I want to get this information somehow. I'm using VB .NET
> 2003, but understand C# also quite well.
>
> --
> Thanks in advance!
>
> Mika
>
>



 
Reply With Quote
 
Josip Medved
Guest
Posts: n/a
 
      27th Aug 2004
> How can I check which chars in String are UpperCase chars?


Dim strX As String = "aAbBc"

For i As Integer = 0 To strX.Length
If strX.SubString(i,1) = strX.SubString(i,1).ToUpper Then
MessageBox.Show("Uppercase on " + CStr(i) )
End If
Next

--
Pozdrav,
Josip Medved, MCSD
http://www.jmedved.com


 
Reply With Quote
 
Mika M
Guest
Posts: n/a
 
      27th Aug 2004
Oh! so simple - and I didn't got it by myself

Thanks for every reply!


 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      27th Aug 2004
* "Mika M" <mika.mahonen@nospam_kolumbus.fi> scripsit:
> How can I check which chars in String are UpperCase chars?
>
> I mean for example string "aAbBc" has second and fourth character uppercase
> characters, so I want to get this information somehow. I'm using VB .NET
> 2003, but understand C# also quite well.


\\\
Dim c As Char
For Each c in "aAbBc"
If Char.IsUpper(c) Then
...
End If
Next c
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
 
Reply With Quote
 
Jay B. Harlow [MVP - Outlook]
Guest
Posts: n/a
 
      27th Aug 2004
Mika,
I would use Char.IsUpper that Herfried identified, the System.Char structure
has a number of shared functions that will check what "kind" of character
that was passed. Such as: IsControl, IsDigit, IsLetter, IsLetterOrDigit,
IsLower, IsNumber, IsPunctuation, IsSeparator, IsSurrogate, IsSymbol,
IsUpper, IsWhiteSpace.

You can also use Char.GetUnicodeCategory for similar information.

Hope this helps
Jay

"Mika M" <mika.mahonen@nospam_kolumbus.fi> wrote in message
news:(E-Mail Removed)...
> Hi!
>
> How can I check which chars in String are UpperCase chars?
>
> I mean for example string "aAbBc" has second and fourth character

uppercase
> characters, so I want to get this information somehow. I'm using VB .NET
> 2003, but understand C# also quite well.
>
> --
> Thanks in advance!
>
> Mika
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Forcing Upper case of field at table level? Yuta Microsoft Access Database Table Design 2 17th Jul 2009 01:45 AM
One single character to upper case stevewy@hotmail.com Microsoft Excel Programming 7 8th Sep 2008 05:18 PM
Help Preserving the Character Case of a string... CES Microsoft Access Form Coding 2 11th Jan 2007 07:27 AM
25 Character CD key on the back of the CD jewel case? =?Utf-8?B?bGl0dGxlX3dvbmRlcnM=?= Microsoft Word Document Management 1 13th Oct 2004 04:07 PM
Using a wildcard character in Select Case Rose Microsoft Access VBA Modules 5 24th May 2004 04:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:52 PM.