Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToString ¶
BytesToString converts a string to a byte slice.
This is a shallow copy, means that the returned string reuse the underlying array in byte slice, it's your responsibility to keep the input byte slice survive until you don't access the string anymore.
func BytesToStringNew ¶
BytesToStringNew converts a byte slice to a new string. (Deep copy)
This function is used in case you want get a fresh version of string converted from the input byte slice, the returned string is a real string, this means the data field on this string is read only.
func DeepCopyBytes ¶
DeepCopyBytes returns a deep copy of the input byte slice.
func DeepCopyString ¶
DeepCopyString returns a deep copy of the input string.
This function is used in case of the input string is converted from BytesToString, this means it is not a real string, but share an underlying array with a byte slice, use this function to create a real string.
func StringToBytes ¶
StringToBytes converts a string to a byte slice.
This is a shallow copy, means that the returned byte slice reuse the underlying array in string, so you can't change the returned byte slice in any situations.
func StringToBytesNew ¶
StringToBytesNew converts a string to a new byte slice.
The returned byte slice can be modified, it is actually a new byte slice, and it's content equal to the input string.
Types ¶
This section is empty.