Skip to content

Instantly share code, notes, and snippets.

@yuchan
yuchan / substring.go
Created June 2, 2012 09:20
Substring #GoLang
//Original
func substr(s string,pos,length int) string{
bytes:=[]byte(s)
l := pos+length
if l > len(bytes) {
l = len(bytes)
}
return string(bytes[pos:l])
}