stringutil

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureCommaDelimitedAddresses

func EnsureCommaDelimitedAddresses(s string) string

EnsureCommaDelimitedAddresses is used by AddressList to ensure that address lists are properly delimited.

func FindUnquoted

func FindUnquoted(s string, v rune, quote rune) []int

FindUnquoted returns the indexes of the instance of v in s, or empty slice if v is not present in s. It ignores v present inside quoted runs.

func JoinAddress

func JoinAddress(addrs []mail.Address) string

JoinAddress formats a slice of Address structs such that they can be used in a To or Cc header.

func NewLockedSource

func NewLockedSource(seed int64) rand.Source64

NewLockedSource creates a source of randomness using the given seed.

func SplitAfterUnquoted

func SplitAfterUnquoted(s string, sep rune, quote rune) []string

SplitAfterUnquoted slices s into all substrings after each instance of sep and returns a slice of those substrings.

If s does not contain sep and sep is not empty, SplitAfterUnquoted returns a slice of length 1 whose only element is s.

It ignores sep present inside quoted runs.

func SplitUnquoted

func SplitUnquoted(s string, sep rune, quote rune) []string

SplitUnquoted slices s into all substrings separated by sep and returns a slice of the substrings between those separators.

If s does not contain sep and sep is not empty, SplitUnquoted returns a slice of length 1 whose only element is s.

It ignores sep present inside quoted runs.

func UUID

func UUID(rs rand.Source) string

UUID generates a random UUID according to RFC 4122, using optional rand if supplied

func Wrap

func Wrap(max int, strs ...string) []byte

Wrap builds a byte slice from strs, wrapping on word boundaries before max chars

Types

This section is empty.

Jump to

Keyboard shortcuts

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