Ispangram

// ispangram.go
// description: Checks if a given string is pangram or not
// details: A pangram is a sentence or expression that uses all the letters of the alphabet.
// Reference: https://www.geeksforgeeks.org/pangram-checking/
// Author : Kavitha J

package pangram

import (
	"regexp"
	"strings"
)

func cleanString(text string) string {
	cleanText := strings.ToLower(text)                      // Convert to lowercase
	cleanText = strings.Join(strings.Fields(cleanText), "") // Remove spaces
	regex, _ := regexp.Compile(`[^\p{L}\p{N} ]+`)           // Regular expression for alphanumeric only characters
	return regex.ReplaceAllString(cleanText, "")
}

func IsPangram(text string) bool {
	cleanText := cleanString(text)
	if len(cleanText) < 26 {
		return false
	}
	var data = make(map[rune]bool)
	for _, i := range cleanText {
		data[i] = true
	}
	return len(data) == 26
}
Algerlogo

Β© Alger 2022

About us

We are a group of programmers helping each other build new things, whether it be writing complex encryption programs, or simple ciphers. Our goal is to work together to document and model beautiful, helpful and interesting algorithms using code. We are an open-source community - anyone can contribute. We check each other's work, communicate and collaborate to solve problems. We strive to be welcoming, respectful, yet make sure that our code follows the latest programming guidelines.