antzucaro / matchr

An approximate string matching library for the Go programming language.
Other
178 stars 26 forks source link

Remove or modify charAt() #3

Closed JamesOwenHall closed 9 years ago

JamesOwenHall commented 9 years ago

In util.go, the function charAt is never used and can be removed completely. However, if you intend to use it, you may want to change it.

Currently, if the provided index is out of bounds, the function returns 0. However Go, unlike C, allows null characters (\u0000) in strings. It's therefore impossible to distinguish between an out-of-bound index and a null character.

You could fix this by returning -1 instead, since the rune type is just an alias for int32.

antzucaro commented 9 years ago

I should remove it. Thank you!