gstr

package
v0.1.27 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

@Title @Description @Author @Date 11/6/20 9:42 PM

@Title @Description @Author @Date 11/6/20 12:05 PM

@Title @Description @Author @Date 11/6/20 9:43 PM

Index

Constants

This section is empty.

Variables

View Source
var (
	MacSeparators = []string{":", "-", " ", "."}
	MacRegexp     = regexp.MustCompile(`^[a-fA-F0-9]{12}$`)
)

Functions

func ConvertHexToIp added in v0.1.4

func ConvertHexToIp(hex string) string

func ConvertIpToHex added in v0.1.4

func ConvertIpToHex(ip string) string

func FormatMacAddress

func FormatMacAddress(input string) string

FormatMacAddress @Description: format mac address to 12 bits @param input @return string

func GenerateUuid added in v0.1.4

func GenerateUuid() string

func HostsOfCidr added in v0.1.4

func HostsOfCidr(cidr string) ([]string, error)

func IPString2Long

func IPString2Long(ip string) uint

func IntegerStringToMac added in v0.1.4

func IntegerStringToMac(macInt, separator string) []string

func IsIpAddress added in v0.1.4

func IsIpAddress(ip string) bool

IsIpAddress 判断是否是IP地址

func IsValidIp added in v0.1.4

func IsValidIp(input string) bool

func IsValidMac added in v0.1.9

func IsValidMac(input string) bool

func Long2IPString

func Long2IPString(i uint) string

Long2IPString 把数值转为ip字符串

func SplitAndTrim

func SplitAndTrim(str, delimiter string, characterMask ...string) []string

SplitAndTrim splits string <str> by a string <delimiter> to an array, and calls Trim to every element of this array. It ignores the elements which are empty after Trim.

func SplitWithoutTrim added in v0.1.19

func SplitWithoutTrim(str, delimiter string, characterMask ...string) []string

func StringToFloat64 added in v0.1.20

func StringToFloat64(input string, defaultVal float64) float64

func StringToInt

func StringToInt(input string) int

func StringToIntWithDefault added in v0.1.20

func StringToIntWithDefault(input string, defaultVal int) int

StringToIntWithDefault @Description: @param input @param defaultVal default value @return int

func ToString

func ToString(a interface{}) string

func Trim

func Trim(str string, characterMask ...string) string

Trim strips whitespace (or other characters) from the beginning and end of a string. The optional parameter <characterMask> specifies the additional stripped characters.

func TrimLeft

func TrimLeft(str string, characterMask ...string) string

TrimLeft strips whitespace (or other characters) from the beginning of a string.

func TrimLeftStr

func TrimLeftStr(str string, cut string) string

TrimLeftStr strips all of the given <cut> string from the beginning of a string. Note that it does not strips the whitespaces of its beginning.

func TrimRight

func TrimRight(str string, characterMask ...string) string

TrimRight strips whitespace (or other characters) from the end of a string.

func TrimRightStr

func TrimRightStr(str string, cut string) string

TrimRightStr strips all of the given <cut> string from the end of a string. Note that it does not strips the whitespaces of its end.

func TrimStr

func TrimStr(str string, cut string) string

TrimStr strips all of the given <cut> string from the beginning and end of a string. Note that it does not strips the whitespaces of its beginning or end.

Types

This section is empty.

Jump to

Keyboard shortcuts

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