Skip to content

Commit

Permalink
simplify if statements
Browse files Browse the repository at this point in the history
  • Loading branch information
tmck-code committed Apr 4, 2024
1 parent 655870d commit 4a21bb0
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/pokesay/print.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,11 @@ func nameLength(names []string) int {

for _, name := range names {
for _, c := range name {
// check if ascii
if c < 128 {
// check if ascii or single-width unicode
if (c < 128) || (SingleWidthCars[string(c)]) {
totalLen++
} else {
// check if single width character
if SingleWidthCars[string(c)] {
totalLen++
} else {
totalLen += 2
}
totalLen += 2
}
}
}
Expand Down

0 comments on commit 4a21bb0

Please sign in to comment.