473,662 Members | 2,536 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Check if character is Uppercase

1 New Member
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 8137
SioSio
272 Contributor
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 Recognized Expert New Member
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 New Member
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
3811
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 fine. But I sure would like to eliminate this headache. -- God Bless you, Al Kolff
9
12595
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 character 2 and replace it with a different character.... etc.... until completing the string? thanks....
6
25436
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 would be thanks
2
21876
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 importing purposes later on!). For example: re_200_3 <-- I want this to be returned because the "re" isn't uppercase. RE_200_2 <-- This value would be fine because it *is* uppercase.
1
3255
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 contains only 1 character, a '.' must follow the char. -If we find a character that isn't a letter (.&*-), we must swap it for a '/' and add the correct spaces. I tried making a function but my switch seems to have an error. If anyone
6
1461
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 somehow. I'm using VB .NET 2003, but understand C# also quite well. -- Thanks in advance!
3
4302
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 best practice would be. I was thinking I could use an arrayList which has the "contains" property and do this: If not arr.Contains(s1) then --- don't continue but my list of codes might be about 50 char combinations. So I was thinking a...
2
6227
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 perfectly ok and I get a file that looks like this: <element attribute="" /> which looks perfectly valid but won't open up with an XML viewer because it
3
4686
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 have an idea...i want to check character by character...do someone have an example for this?
2
4817
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? I tried using CONSTRAINT ValidID CHECK (clientID LIKE '') But if I do this, and I insert a id 'a123e' (starting and ending with small capital letter, it will still let me go through. By right, it should forbid me to do so.
0
8432
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8764
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8546
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7367
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6186
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5654
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4180
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1752
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.