Documentation ¶
Overview ¶
str_convert 字符串,数字相互转换的一些辅助函数
Index ¶
- func Addslashes(str string) string
- func Base64Decode(str string) (string, error)
- func Base64Encode(str string) string
- func Bin2hex(src []byte) string
- func Bindec(str string) (string, error)
- func Chr(ascii int) string
- func Crc32(str string) uint32
- func DeAES(in, key, iv []byte) ([]byte, error)
- func Decbin(number int64) string
- func Empty(val interface{}) bool
- func EnAES(in, key, iv []byte) ([]byte, error)
- func Explode(delimiter, str string) []string
- func Float64ToStr(f64 float64) string
- func HTMLEntities(str string) string
- func HTMLEntityDecode(str string) string
- func HTMLSpecialchars(str string) string
- func HTMLSpecialcharsDecode(str string) string
- func HTTPBuildQuery(queryData url.Values) string
- func Hash(mem []byte) uint64
- func Hex2bin(str string) []byte
- func IP2long(ipAddress string) uint32
- func Implode(glue string, pieces []string) string
- func Int64ToStr(i64 int64) string
- func IntToStr(n int) string
- func Krand(size int, kind int) string
- func LcFirst(str string) string
- func Long2ip(properAddress uint32) string
- func Ltrim(str string, characterMask ...string) string
- func MbStrlen(str string) int
- func Md5(str string) string
- func Md5File(filename string) (string, error)
- func NewUUID() string
- func Ord(character string) rune
- func ParseURL(str string) (*url.URL, error)
- func Rawurldecode(str string) (string, error)
- func Rawurlencode(str string) string
- func RndUuid() string
- func Rtrim(str string, characterMask ...string) string
- func Sha1(str string) string
- func Sha1File(path string) (string, error)
- func StrJoin(sep string, str ...string) string
- func StrJoinByBuf(str ...string) string
- func StrRepeat(input string, multiplier int) string
- func StrReplace(search, replace, subject string, count int) string
- func StrShuffle(str string) string
- func StrToFloat64(str string) float64
- func StrToInt(s string) int
- func StrToInt64(s string) int64
- func Stripos(haystack, needle string) int
- func Stripslashes(str string) string
- func Strlen(str string) int
- func Strpos(haystack, needle string) int
- func Strripos(haystack, needle string) int
- func Strrpos(haystack, needle string) int
- func Strstr(haystack string, needle string) string
- func Strtolower(str string) string
- func Strtoupper(str string) string
- func Substr(str string, start uint, length int) string
- func Trim(str string, characterMask ...string) string
- func URLDecode(str string) (string, error)
- func URLEncode(str string) string
- func UcFirst(str string) string
- func Ucwords(str string) string
- func Uniqid(prefix string) string
- func Uuid() string
- func Xss(str string) string
- func XssUnescape(str string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Chr ¶
================str chr,ord func====================== Chr returns a one-character string containing the character specified by ascii go1.15 return string(rune(ascii))
func EnAES ¶
=================str aes/des func========================== key = "abcdefghijklmnopqrstuvwxyz123456" iv = "0123456789ABCDEF"
func Explode ¶
=================str explode,implode,strlen================ Explode returns an slice of strings, each of which is a substring of str formed by splitting it on boundaries formed by the string delimiter.
func Float64ToStr ¶
Float64ToStr float64 to string 'e' (-d.dddde±dd,十进制指数)
func HTMLEntities ¶ added in v1.11.12
HTMLEntities htmlentities()
func HTMLEntityDecode ¶ added in v1.11.12
HTMLEntityDecode html_entity_decode()
func HTMLSpecialchars ¶
=====================html special characters================ HTMLSpecialchars converts special characters to HTML entities
func HTMLSpecialcharsDecode ¶
HTMLSpecialcharsDecode converts special HTML entities back to characters
func HTTPBuildQuery ¶
HTTPBuildQuery http_build_query() url a=1&b=2
func Implode ¶
Implode returns a string containing a string representation of all the slice elements in the same order, with the glue string between each element.
func IntToStr ¶
================str,int,int64,float64 conv func======================= IntToStr int-->string
func Krand ¶
================str krand func=========== Krand 根据kind生成不同风格的指定区间随机字符串 纯数字kind=0,小写字母kind=1 大写字母kind=2,数字+大小写字母kind=3
func Md5 ¶
==============str md5,md5File,sha1,crc32,bin2hex,hex2bin,hash func======= Other advanced functions, please see the thinkgo/crypto package. md5 func
func NewUUID ¶
func NewUUID() string
=================uuid,rnduuid,uniqid func==================== NewUUID 通过随机数的方式生成uuid 如果rand.Read失败,就按照当前时间戳+随机数进行md5方式生成 该方式生成的uuid有可能存在重复值 返回格式:7999b726-ca3c-42b6-bda2-259f4ac0879a
func Rawurlencode ¶
Rawurlencode rawurlencode(str) Rawurlencode is URL-encode according to RFC 3986. Rawurlencode is identical to URLEncode except that it does not escape space to +.
func RndUuid ¶
func RndUuid() string
RndUuid 基于时间ns和随机数实现唯一的uuid 在单台机器上是不会出现重复的uuid 如果要在分布式的架构上生成不重复的uuid 只需要在rndStr的前面加一些自定义的字符串 返回格式:eba1e8cd-0460-4910-49c6-44bdf3cf024d
func StrReplace ¶
StrReplace str_replace()
func Stripos ¶
Stripos find position of the first occurrence of a case-insensitive substring in a string
func Strpos ¶
=================str strpos,Strrpos,stripos,Strripos func==================== Strpos find position of first occurrence of string in a string It's multi-byte safe. return -1 if can not find the substring
func Strripos ¶
Strripos find the position of the last occurrence of a case-insensitive substring in a string
func Strtolower ¶
Strtolower strtolower(str) makes a string lowercase
func Strtoupper ¶
Strtoupper strtoupper(str) makes a string uppercase
func URLDecode ¶
URLDecode decodes any %## encoding in the given string. Plus symbols ('+') are decoded to a space character.
func URLEncode ¶
URLEncode returns a string in which all non-alphanumeric characters except -_. have been replaced with a percent (%) sign followed by two hex digits and spaces encoded as plus (+) signs. It is encoded the same way that the posted data from a WWW form is encoded, that is the same way as in application/x-www-form-urlencoded media type.
Types ¶
This section is empty.