Skip to content

Commit 94b0379

Browse files
authored
Fix bug
1 parent 7e964bf commit 94b0379

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

modules/util/string.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ func UnsafeStringToBytes(s string) []byte {
9999
// GetFirstCharacters returns the first n characters of a string
100100
func GetFirstCharacters(s string, n int) string {
101101
r := []rune(s)
102-
if len(s) <= n {
103-
return string(r[:n])
102+
if len(r) <= n {
103+
return s
104104
}
105-
return s[:n]
105+
return string(r[:n])
106106
}

0 commit comments

Comments
 (0)