8000 GitHub - xiaoxin01/goutil
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

xiaoxin01/goutil

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Report Card Build Status

a util package for go

strutil

substring

SubBytesWithRuneCheck/SubStringWithByteLimit get sub string very fast for limit the size of bytes or string when it's very large.

s := `123456789壹贰叁肆伍陆柒捌玖éèǔ`
SubStringWithByteLimit(s, 9) // 123456789
SubStringWithByteLimit(s, 10) // 123456789
SubStringWithByteLimit(s, 12) // 123456789壹

Benchmark:

BenchmarkSubBytesWithRuneCheck-8 143022060 8.38 ns/op 0 B/op 0 allocs/op
BenchmarkSubStringWithByteLimit-8 24984644 44.9 ns/op 48 B/op 1 allocs/op

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

0