How to check if a string is pangram in VB.NET

1 Answer

0 votes
' A string is a pangram if it contains all the characters of the alphabet ignoring case

Imports System
Imports System.Linq

Public Class Program
	Public Shared Function isStringPangram(ByVal str As String) As Boolean
        Return str.ToLower().Where(Function(ch) Char.IsLetter(ch)).GroupBy(Function(ch) ch).Count() = 26
    End Function

    Public Shared Sub Main()
        Dim str As String = "The quick brown fox jumps over the lazy dog"
				
        Console.WriteLine(isStringPangram(str))
    End Sub
End Class
		
		
		
' run:
'
' True
'

 



answered Sep 14, 2023 by avibootz
edited Sep 14, 2023 by avibootz

Related questions

1 answer 125 views
125 views asked Sep 14, 2023 by avibootz
1 answer 122 views
122 views asked Sep 14, 2023 by avibootz
1 answer 137 views
137 views asked Sep 14, 2023 by avibootz
1 answer 103 views
103 views asked Sep 14, 2023 by avibootz
1 answer 110 views
1 answer 131 views
...