Skip to content

Instantly share code, notes, and snippets.

@AKosterin
Created November 14, 2016 12:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AKosterin/6254f0652f3c348be3bd20df871b5077 to your computer and use it in GitHub Desktop.
Save AKosterin/6254f0652f3c348be3bd20df871b5077 to your computer and use it in GitHub Desktop.
func separateString(str, seporator string, count int) string {
rs := []rune(str)
log.Println("rs = ", rs)
srs := []rune(seporator)
log.Println("srs = ", srs)
for i := 0; i * (count + len(srs)) < len(rs)-count; i++ {
rs = append(rs[:i * (count + len(srs)) + count] ,append(srs, rs[i * (count + len(srs)) + count :]...)...)
}
return string(rs)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment