mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2026-04-23 00:07:15 +08:00
all: refactor swizzling validation to use ContainsRune (#3292)
Replaces strings.IndexRune checks with strings.ContainsRune in IsValidSwizzling for improved readability and idiomatic Go usage.
This commit is contained in:
@@ -373,21 +373,21 @@ func IsValidSwizzling(s string) bool {
|
||||
switch {
|
||||
case strings.IndexByte(xyzw, s[0]) >= 0:
|
||||
for _, c := range s {
|
||||
if strings.IndexRune(xyzw, c) == -1 {
|
||||
if !strings.ContainsRune(xyzw, c) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
case strings.IndexByte(rgba, s[0]) >= 0:
|
||||
for _, c := range s {
|
||||
if strings.IndexRune(rgba, c) == -1 {
|
||||
if !strings.ContainsRune(rgba, c) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
case strings.IndexByte(strq, s[0]) >= 0:
|
||||
for _, c := range s {
|
||||
if strings.IndexRune(strq, c) == -1 {
|
||||
if !strings.ContainsRune(strq, c) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user