Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,945 questions

51,886 answers

573 users

How to check if lowercase and uppercase characters in a string are in same order with VB.NET

1 Answer

0 votes
Imports System

Public Class Test
    Public Shared Function lowercase_uppercase_characters_same_order(s As String) As Boolean
         Dim len As Integer = s.Length
         Dim lower_s As String = ""
         Dim upper_s As String = ""

         For i As Integer = 0 To len - 1
             If (s(i) >= "A" And s(i) <= "Z") Then
                  upper_s = upper_s + s(i)
             End If
             If (s(i) >= "a" And s(i) <= "z") Then    
                 lower_s = lower_s + s(i) 
             End If
         Next

         return lower_s.ToUpper() = upper_s
    End Function

    Public Shared Sub Main()
        Dim s As String = "vVb.BnNeETt" ' vb.netVB.NET
      
        If (lowercase_uppercase_characters_same_order(s)) Then 
            Console.Write("Yes")
        Else
            Console.Write("No")
        End If
    End Sub
End Class


' run:
'
' Yes

 



answered Nov 9, 2019 by avibootz
...