Steffi1013
MIS
I need help! I need to be able to read a string entered into a text that is at least 15 character long and count the number of Upper Case letters in that string... How do I do this???? Please help
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Private Function NumberOfUppercaseCharacters(text As String) As Integer
Dim c() As Char = text.ToCharArray
Dim count As Integer
For Each c2 As Char In c
If Char.IsUpper(c2) Then
count += 1
End If
Next
Return count
End Sub
If TextBox1.Text.Length < 15 Then
MsgBox("Invalid format! Less than 15 characters.", MsgBoxStyle.Critical)
Exit Sub
End If
Private Function GetCaps(ByVal source As String, ByVal requirednumber As Integer) As Boolean
Dim rx As New System.Text.RegularExpressions.Regex("[A-Z]")
Return rx.Matches(source).Count = requirednumber
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim s As String = "This has some CAPS"
MessageBox.Show(GetCaps(s, 15).ToString)
End Sub