473,395 Members | 2,006 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Character case level question

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
Nov 21 '05 #1
6 1440

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!
Nov 21 '05 #2
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:Oq**************@TK2MSFTNGP12.phx.gbl...
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

Nov 21 '05 #3
> 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
Nov 21 '05 #4
Oh! so simple - and I didn't got it by myself :)

Thanks for every reply!
Nov 21 '05 #5
* "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/>
Nov 21 '05 #6
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:Oq**************@TK2MSFTNGP12.phx.gbl...
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

Nov 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Albretch | last post by:
.. Can you define the Character Set for particular tables instead of databases? . Which DBMSs would let you do that? . How do you store in a DBMS i18n'ed users' from input, coming over the web...
0
by: Phillip Farber | last post by:
Hello, I'm posting here with a somewhat technical question in the hope of finding someone with experience coding C++ against the SP_API in OpenSP 1.5. I have an app that uses the SP_API to...
9
by: MSUTech | last post by:
Hello, What is the best way to check each character within a string? For doing something like encryption, where you check character 1 and replace it with a different character.. then check...
9
by: jmev7 | last post by:
I'm in the US, and have to constantly take data input from other countries. Some of this data has characters which I can't understand, since it's input from other language keyboards. This prevents...
6
by: Lucvdv | last post by:
In a sorted list, certain characters are grouped together, for example "çb" (cedille b) comes after "ca" but before "cc". Is there a built-in way to find out what 'base character', such as C for...
110
by: alf | last post by:
Hi, is it possible that due to OS crash or mysql itself crash or some e.g. SCSI failure to lose all the data stored in the table (let's say million of 1KB rows). In other words what is the worst...
2
by: Jason | last post by:
Hi, I was wondering if anyone could advise me on this. Right now I am setting up a DB2 UDB V8.2.3 database with UTF8 character set, which will work with a J2EE application running on...
8
by: arnuld | last post by:
i have created a solutions myself. it compiles without any trouble and runs but it prints some strange characters. i am not able to find where is the trouble. ...
19
by: bowlderyu | last post by:
Hello, all. If a struct contains a character strings, there are two methods to define the struct, one by character array, another by character pointer. E.g, //Program for struct includeing...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.