gxstrings

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayRemoveAt

func ArrayRemoveAt(a interface{}, i int)

code example:

data := []string{"one", "two", "three"} ArrayRemoveAt(&data, 2) fmt.Println("data len:", len(data), ", data:", data)

data2 := []int32{1, 2, 3} ArrayRemoveAt(&data2, 2) fmt.Println("data2 len:", len(data2), ", data2:", data2)

func BytePointer

func BytePointer(b []byte) unsafe.Pointer

returns &b[0], which is not allowed in go

func Contains

func Contains(s []string, e string) bool

func RandStringBytesMaskImprSrc

func RandStringBytesMaskImprSrc(n int) string

func Slice

func Slice(s string) (b []byte)

func String

func String(b []byte) (s string)

func StringLength

func StringLength(s string) int

get utf8 character numbers

func StringPointer

func StringPointer(s string) unsafe.Pointer

returns &s[0], which is not allowed in go

Types

type UUID

type UUID [16]byte

func NewUUID

func NewUUID() *UUID

create a new uuid v4

func (*UUID) HexString

func (u *UUID) HexString() string

func (*UUID) String

func (u *UUID) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL