feat: count characters consistently
This commit is contained in:
parent
80ca1cae00
commit
8433a1523a
9 changed files with 54 additions and 20 deletions
11
backend/common/common.go
Normal file
11
backend/common/common.go
Normal file
|
@ -0,0 +1,11 @@
|
|||
// Package common contains functions and types common to all (or most) packages.
|
||||
package common
|
||||
|
||||
import "unicode/utf8"
|
||||
|
||||
func StringLength(s *string) int {
|
||||
if s == nil {
|
||||
return -1
|
||||
}
|
||||
return utf8.RuneCountInString(*s)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue