Documentation ¶
Overview ¶
Package utf8string provides an efficient way to index strings by rune rather than by byte.
Index ¶
- Constants
- func CheckInt(form url.Values, field string) bool
- func DoGet(url string, extras ...int) (body []byte, err error)
- func DoPost(url string, data url.Values, extras ...int) (body []byte, err error)
- func DoPostRaw(url string, bodyType string, data interface{}, extras ...int) (body []byte, err error)
- func EmbedWide(content string) string
- func Exist(filename string) bool
- func FetchRealUrl(uri string) (realUrl string)
- func Gravatar(avatar string, emailI interface{}, size uint16, isHttps bool) string
- func InSlice(i int, slice []int) bool
- func IsAjax(ctx echo.Context) bool
- func IsDir(filename string) bool
- func IsFile(filename string) bool
- func Max(x, y int) int
- func Models2Intslice(models interface{}, idField string) []int
- func MonthDayNum(t time.Time) int
- func SafeHtml(s string) string
- func ScanDir(directory string) []string
- func SetCaptcha(id string)
- func Struct2Map(dest map[string]interface{}, src interface{}) error
- func Substring(str string, length int, suffix string) string
- func TimeAgo(t time.Time) string
- func UMin(x, y int) int
- func UnderscoreName(name string) string
- type String
Constants ¶
const CaptchaLen = 4
const XRequestedWith = "X-Requested-With"
Variables ¶
This section is empty.
Functions ¶
func FetchRealUrl ¶
FetchRealUrl 获取链接真实的URL(获取重定向一次的结果URL)
func Models2Intslice ¶
model中类型提取其中的 idField(int 类型) 属性组成 slice 返回
func Struct2Map ¶
Types ¶
type String ¶
type String struct {
// contains filtered or unexported fields
}
String wraps a regular string with a small structure that provides more efficient indexing by code point index, as opposed to byte index. Scanning incrementally forwards or backwards is O(1) per index operation (although not as fast a range clause going forwards). Random access is O(N) in the length of the string, but the overhead is less than always scanning from the beginning. If the string is ASCII, random access is O(1). Unlike the built-in string type, String has internal mutable state and is not thread-safe.
func (*String) At ¶
At returns the rune with index i in the String. The sequence of runes is the same as iterating over the contents with a "for range" clause.
func (*String) Init ¶
Init initializes an existing String to hold the provided contents. It returns a pointer to the initialized String.
func (*String) IsASCII ¶
IsASCII returns a boolean indicating whether the String contains only ASCII bytes.
func (*String) RuneCount ¶
RuneCount returns the number of runes (Unicode code points) in the String.