UnsafeConvertStringToBytes converts a string to a byte array to be used with string encoding functions. Note that the output byte array should not be modified if the input string is expected to be used again - doing so could violate Go semantics.
(s string)
| 917 | // modified if the input string is expected to be used again - doing so could |
| 918 | // violate Go semantics. |
| 919 | func UnsafeConvertStringToBytes(s string) []byte { |
| 920 | // unsafe.StringData output is unspecified for empty string input so always |
| 921 | // return nil. |
| 922 | if len(s) == 0 { |
| 923 | return nil |
| 924 | } |
| 925 | return unsafe.Slice(unsafe.StringData(s), len(s)) |
| 926 | } |
| 927 | |
| 928 | // EncodeStringAscending encodes the string value using an escape-based encoding. See |
| 929 | // EncodeBytes for details. The encoded bytes are append to the supplied buffer |
no test coverage detected
searching dependent graphs…