stringutil

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 6 Imported by: 23

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// HostnameRegex is the regex for valid hostnames.
	HostnameRegex = regexp.MustCompile(`^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$`)
	// IPV4Regex is the regex for valid IPv4 addresses.
	IPV4Regex = regexp.MustCompile(`^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`)
)

Functions

func CleanAddress

func CleanAddress(addr string) string

CleanAddress cleans the input address before returning it.

func IsValidAddress

func IsValidAddress(addr string) bool

IsValidAddress returns a boolean indicating whether the specified address is valid.

func IsValidAddressErr added in v1.4.0

func IsValidAddressErr(addr string) error

IsValidAddressErr check whether the specified address is valid and returns error

Types

This section is empty.

Jump to

Keyboard shortcuts

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