Documentation ¶
Overview ¶
Package str string handler method.
Index ¶
- Constants
- func Base64Decode(code string) string
- func Base64Encode(origin string) string
- func GetNotEmpty(strs ...string) string
- func InQuei(s string, que []string) int
- func PadLeft(s string, pad string, le int) string
- func PadRight(s string, pad string, le int) string
- func QueueMaxLen(vList []string) int
- func RandStrBase(base string, length int) string
- func Render(tpl string, data any) (string, error)
- func SplitSafe(s, sep string) []string
- func TimeParse(tmStr string) (time.Time, error)
- func TimeParseLayout(tmStr string) (string, error)
- type RandString
- type Str
- type TimeLayoutDetector
- type Url
- Bugs
Constants ¶
const ( NumberStr = "0123456789" LowerStr = "abcdefghijklmnopqrstuvwxyz" UpperStr = "ABCDEFGHJIKLMNOPQRSTUVWXYZ" )
Variables ¶
This section is empty.
Functions ¶
func GetNotEmpty ¶
GetNotEmpty get not empty by many strings.
func QueueMaxLen ¶
QueueMaxLen gets the maximum length of a value in an array
func RandStrBase ¶
RandStrBase make rand string by base string.
func TimeParseLayout ¶
TimeParseLayout Resolve the given time format into (convert to) standard format. The supported formats are as follows(time can be missing): - 2006-01-02 15:04:06 - 2006-01-02 - 2006-1-2 - 2006/01/02 15:04:06 - 2006年01月02日 15:04:06 - 20060102 15:04:06
Types ¶
type RandString ¶
type RandString struct { }
RandString rand string creator.
var RandStr RandString
RandStr rand string instance
func (RandString) Letter ¶
func (rs RandString) Letter(length int) string
Letter get random latin alpha.
func (RandString) Number ¶
func (rs RandString) Number(length int) string
Number get random number by length
func (RandString) SafeStr ¶
func (rs RandString) SafeStr(length int) string
SafeStr get safe string not contain special symbol
type Str ¶
type Str string
func (Str) CamelCase ¶
CamelCase camelcase --> snake case covert string to be lower style, like:
`first_name` -> `FirstName`, `get_height_width_rate` -> `GetHeightWidthRate`
snake case --> camelcase
func (Str) IsLatinAlpha ¶
func (Str) LowerStyle ¶
LowerStyle camelcase --> snake case covert string to be lower style, like:
`FirstName` -> `first_name`, `getHeightWidthRate` -> `get_height_width_rate`
func (Str) ParseUnicode ¶
ParseUnicode parse unicode like `\u00001` to real char
type TimeLayoutDetector ¶
type TimeLayoutDetector struct {
// contains filtered or unexported fields
}
func NewTimeLotDtr ¶
func NewTimeLotDtr(tmStr string) *TimeLayoutDetector
func (*TimeLayoutDetector) Layout ¶
func (c *TimeLayoutDetector) Layout() string
func (*TimeLayoutDetector) Parse ¶
func (c *TimeLayoutDetector) Parse() (string, error)
Notes ¶
Bugs ¶
Url.AbsHref 中解析 "vpath" `test/p1/p2` 与 `./test/p1/p2` 的一致性问题