is

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package is provides pure predicates for common string formats.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64

func Base64(s string) bool

func CIDR added in v0.2.0

func CIDR(s string) bool

CIDR reports a valid CIDR notation (IPv4 or IPv6).

func CIDRv4 added in v0.2.0

func CIDRv4(s string) bool

CIDRv4 reports a valid IPv4 CIDR notation.

func CIDRv6 added in v0.2.0

func CIDRv6(s string) bool

CIDRv6 reports a valid IPv6 CIDR notation.

func CreditCard added in v0.2.0

func CreditCard(s string) bool

CreditCard reports a 12-19 digit card number passing Luhn; spaces and dashes between digit groups are ignored.

func E164 added in v0.2.0

func E164(s string) bool

E164 reports an international phone number in E.164 form (+14155552671).

func Email

func Email(s string) bool

func FQDN added in v0.2.0

func FQDN(s string) bool

FQDN reports a fully qualified domain name (requires a TLD, unlike Hostname).

func HexColor added in v0.2.0

func HexColor(s string) bool

HexColor reports a #-prefixed hex color (3, 4, 6 or 8 digits).

func Hostname

func Hostname(s string) bool

func IP

func IP(s string) bool

func IPv4

func IPv4(s string) bool

func IPv6

func IPv6(s string) bool

func JSON

func JSON(s string) bool

JSON reports whether s is well-formed JSON (empty is not).

func JWT added in v0.2.0

func JWT(s string) bool

JWT reports the three dot-separated base64url segments of a JWT.

func Latitude added in v0.2.0

func Latitude(s string) bool

Latitude reports a decimal latitude in [-90, 90].

func Longitude added in v0.2.0

func Longitude(s string) bool

Longitude reports a decimal longitude in [-180, 180].

func Luhn added in v0.2.0

func Luhn(s string) bool

Luhn reports a digit string passing the Luhn checksum.

func MAC

func MAC(s string) bool

MAC accepts any net.ParseMAC format.

func Semver added in v0.2.0

func Semver(s string) bool

Semver reports a semantic version per semver.org (no leading "v").

func TimeZone added in v0.2.0

func TimeZone(s string) bool

TimeZone reports an IANA time zone name ("UTC", "Asia/Shanghai"); "Local" and the empty name are rejected as environment-dependent.

func ULID added in v0.2.0

func ULID(s string) bool

ULID reports a Crockford base32 ULID (case-insensitive).

func URI

func URI(s string) bool

URI requires a scheme but no host, unlike URL.

func URL

func URL(s string) bool

func UUID

func UUID(s string) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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