Skip to content

Instantly share code, notes, and snippets.

@bscott
Created April 27, 2017 15:52
Show Gist options
  • Select an option

  • Save bscott/dda45287463f3af2b59051a8a85aadf5 to your computer and use it in GitHub Desktop.

Select an option

Save bscott/dda45287463f3af2b59051a8a85aadf5 to your computer and use it in GitHub Desktop.
ByteArrayToString
func CToGoString(c []byte) string {
n := -1
for i, b := range c {
if b == 0 {
break
}
n = i
}
return string(c[:n+1])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment