Skip to content

Commit

Permalink
Resolve comment
Browse files Browse the repository at this point in the history
  • Loading branch information
soujanyanmbri committed Oct 10, 2024
1 parent aaed653 commit dd8793d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/strings/strings.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,12 @@ func AsciiToLower(s string) string {
// starting from the specified index.
func asciiToLowerInPlace(s string, start int) string {
res := []byte(s)
res[start] += 'a' - 'A'
const asciiDiff = 'a' - 'A'
res[start] += asciiDiff

for i := start + 1; i < len(res); i++ {
if res[i] >= 'A' && res[i] <= 'Z' {
res[i] += 'a' - 'A'
res[i] += asciiDiff
}
}
return WrapUnsafe(res)
Expand Down

0 comments on commit dd8793d

Please sign in to comment.