MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / cleanString

Function cleanString

strings/pangram/ispangram.go:14–19  ·  view source on GitHub ↗
(text string)

Source from the content-addressed store, hash-verified

12)
13
14func cleanString(text string) string {
15 cleanText := strings.ToLower(text) // Convert to lowercase
16 cleanText = strings.Join(strings.Fields(cleanText), "") // Remove spaces
17 regex, _ := regexp.Compile(`[^\p{L}\p{N} ]+`) // Regular expression for alphanumeric only characters
18 return regex.ReplaceAllString(cleanText, "")
19}
20
21func IsPangram(text string) bool {
22 cleanText := cleanString(text)

Callers 1

IsPangramFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected