Documentation ¶
Overview ¶
http://blog.csdn.net/siddontang/article/details/23541587 reflect.StringHeader和reflect.SliceHeader的结构体只相差末尾一个字段(cap) vitess代码,一种很hack的做法,string和slice的转换只需要拷贝底层的指针,而不是内存拷贝。
2016/09/28 Package gxstrings implements string related utilities.
2016/09/23 Package gxstrings implements string related utilities.
Index ¶
- func ArrayRemoveAt(a interface{}, i int)
- func BytePointer(b []byte) unsafe.Pointer
- func Contains(arr []interface{}, elem interface{}) bool
- func IsNil(i interface{}) bool
- func IsSameStringArray(arr1 []string, arr2 []string) bool
- func IsSubset(parent []interface{}, sub []interface{}) bool
- func Merge(s1 []string, s2 []string) []string
- func RandStringBytesMaskImprSrc(n int) string
- func Slice(s string) (b []byte)
- func String(b []byte) (s string)
- func StringLength(s string) int
- func StringPointer(s string) unsafe.Pointer
- func Strings2Ifs(arr []string) []interface{}
- func Sub(arr1 []string, arr2 []string) []string
- type UUID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArrayRemoveAt ¶
func ArrayRemoveAt(a interface{}, i int)
code example: output: // data len: 2 , cap: 3 , data: [one two] // data2 len: 2 , cap: 3 , data: [1 3]
data := []string{"one", "two", "three"} ArrayRemoveAt(&data, 2) fmt.Println("data len:", len(data), ", cap:", cap(data), ", data:", data)
data2 := []int{1, 2, 3} ArrayRemoveAt(&data2, 1) fmt.Println("data2 len:", len(data2), ", cap:", cap(data2), ", data:", data2)
func BytePointer ¶
returns &b[0], which is not allowed in go
func Contains ¶
func Contains(arr []interface{}, elem interface{}) bool
return true if the elem is in the array arr
func IsSameStringArray ¶ added in v0.3.2
func IsSubset ¶ added in v0.3.2
func IsSubset(parent []interface{}, sub []interface{}) bool
return true if the @sub is a subset of the @parent
func StringPointer ¶
returns &s[0], which is not allowed in go
func Strings2Ifs ¶ added in v0.3.2
func Strings2Ifs(arr []string) []interface{}