1 // stringbyte.go -- string to bytes functions.
3 // Copyright 2010 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
9 // StringByteSlice returns a NUL-terminated slice of bytes
10 // containing the text of s.
11 func StringByteSlice(s
string) []byte {
12 a
:= make([]byte, len(s
)+1);
13 for i
:= 0; i
< len(s
); i
++ {
19 // StringBytePtr returns a pointer to a NUL-terminated array of bytes
20 // containing the text of s.
21 func StringBytePtr(s
string) *byte {
22 p
:= StringByteSlice(s
);