package mcfetch import ( "regexp" "strings" ) // IsValidUsername checks if the username is valid func IsValidUsername(username string) bool { if len(username) < 3 || len(username) > 16 { return false } validChars := "abcdefghijklmnopqrstuvwxyz1234567890_" for _, char := range strings.ToLower(username) { if !strings.ContainsRune(validChars, char) { return false } } return true } // IsValidUUID checks if a UUID is valid func IsValidUUID(uuid string) bool { matched, _ := regexp.MatchString("^[0-9a-fA-F]{32}$", strings.ReplaceAll(uuid, "-", "")) return matched } // UndashUUID removes dashes from UUIDs func UndashUUID(uuid string) string { return strings.ReplaceAll(uuid, "-", "") } // DashUUID adds dashes to UUIDs at standard positions func DashUUID(uuid string) string { return uuid[:8] + "-" + uuid[8:12] + "-" + uuid[12:16] + "-" + uuid[16:20] + "-" + uuid[20:] }