Created
April 27, 2017 15:52
-
-
Save bscott/dda45287463f3af2b59051a8a85aadf5 to your computer and use it in GitHub Desktop.
ByteArrayToString
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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