473,461 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to Check if character is Uppercase

This is my code so far::

Expand|Select|Wrap|Line Numbers
  1. Dim Array(7) As Char
  2.         Dim myman As String = TextBox1.Text
  3.         Dim capcount As Integer = 0
  4.  
  5.         Array = myman.ToCharArray
  6.  
  7.  
  8.         If TextBox1.Text = TextBox2.Text Then
  9.             If TextBox1.Text = "" Then
  10.                 MessageBox.Show("mhm")
  11.                 Stop
  12.             End If
  13.             For i = 0 To 7
  14.                 If Char.IsUpper(Array, i) Then
  15.                     capcount = capcount + 1
  16.                 End If
Jan 28 '19 #1
3 7990
SioSio
272 256MB
Next for For statement and
End if for If then is missing
Index is outside array bounds
Expand|Select|Wrap|Line Numbers
  1. Dim Array(7) As Char
  2. Dim myman As String = TextBox1.Text
  3. Dim capcount As Integer = 0
  4. Array = myman.ToCharArray
  5. If TextBox1.Text = TextBox2.Text Then
  6. If TextBox1.Text = "" Then
  7. MessageBox.Show("mhm")
  8. Stop
  9. End If
  10. For Each c As Char In Array
  11. If Char.IsUpper(c) Then
  12. capcount = capcount + 1
  13. End If
  14. Next
  15. End if
  16.  
Dec 19 '19 #2
cactusdata
214 Expert 128KB
Compare the full string in one line:

Expand|Select|Wrap|Line Numbers
  1. Dim Myman As String
  2.  
  3. 'Myman = "lowercase"
  4. Myman = "MixedCase"
  5. 'Myman = "UPPERCASE"
  6.  
  7. Dim IsUpper As Boolean
  8.  
  9. IsUpper = Myman.ToUpper().Equals(Myman)
  10.  
  11. Console.WriteLine(IsUpper.ToString())
Dec 19 '19 #3
AjayGohil
83 64KB
hi try this for checked uppercase
Expand|Select|Wrap|Line Numbers
  1.    string Mystring = "SimpleWordforExAmple";
  2.         char[] chars;
  3.         char ch;
  4.         int length = Mystring.Length;
  5.         int cnt;
  6.         int totalcntupper = 0;
  7.  
  8.         chars = Mystring.ToCharArray(0, length);
  9.  
  10.         Console.WriteLine("Sample words with capital letters : {0} ", Mystring);
  11.         for (cnt = 0; cnt < length;cnt ++)
  12.         {
  13.             ch = chars[cnt];
  14.  
  15.  
  16.             if (char.IsUpper(ch))
  17.             {
  18.                 Console.WriteLine("Capital letter : #{0}", ch);
  19.                 totalcntupper++;
  20.  
  21.             }
  22.  
  23.  
  24.         }
  25.  
  26.         Console.WriteLine("Count of capital letter(s) : # {0}", totalcntupper);
  27.         Console.ReadLine();
Dec 26 '19 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Al Kolff | last post by:
Hi, Has anyone come across a utility to check the case of a filename versus a php page? I develop locally on a windows machine (Know Know) then upload to a Linux and everything works usually works...
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...
6
by: Dave Hague | last post by:
whats the fastest way to get the size of a character array? i thought about just making a quick loop but 1) i dont know if thats the best way to do it and 2) im not sure what my loop condition...
2
by: Thomas McK | last post by:
Hi all, I'm trying to make a SQL query (against a table in MS Access) where I want to take the value of something, and check to see if the first two letters in that value are capitalized (for...
1
by: The_Kingpin | last post by:
Hi all, I need to make a function that convert a string into a certain format. Here what are the restriction: -The first letter of the first and last name must be uppercase. -If a first name...
6
by: Mika M | last post by:
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...
3
by: Rich | last post by:
The procedure below checks if a character entered into a cell of a datagridview is contained in a string array of valid characters for this particular cell. It seems kludgy. I am asking what the...
2
by: Andy Fish | last post by:
Hi, I have an XML file that was created as a DOM tree in .Net 1.1 and serialized to disk. If I try to put character code 1 inside one of the attributes (don't ask why), it seems to serialize...
3
by: zalina | last post by:
hai guys....i have question about array...let say i have a filename newfile.txt..i want to check the file extension...if the extension is .txt then i'll store it otherwise i'll remove...i already...
2
by: Azuki | last post by:
I want to write a check constraint in SQL Server to check that the ID is exactly 5 characters long, starts and ends with an UPPER case an there are 3 digit in between. Do I use a LIKE clause? Or how?...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.