Documentation
¶
Overview ¶
Package stringutil provides string utility functions.
Index ¶
- Constants
- func ComputeRecipients(from, to, cc, bcc []string, contactEmail, inboxEmail string, ...) (finalTo, finalCC, finalBCC []string)
- func DedupAndExcludeString(list []string, exclude string) []string
- func ExtractEmail(s string) (string, error)
- func FormatDuration(d time.Duration, includeSeconds bool) string
- func GenerateEmailMessageID(messageID string, fromAddress string) (string, error)
- func GetPathFromURL(u string) (string, error)
- func HTML2Text(html string) string
- func RandomAlphanumeric(n int) (string, error)
- func RandomNumeric(n int) (string, error)
- func RemoveEmpty(s []string) []string
- func RemoveItemByValue(slice []string, value string) []string
- func ReverseSlice(source []string)
- func SanitizeFilename(fName string) string
- func ValidEmail(email string) bool
Constants ¶
const (
PasswordDummy = "•"
)
Variables ¶
This section is empty.
Functions ¶
func ComputeRecipients ¶
func ComputeRecipients( from, to, cc, bcc []string, contactEmail, inboxEmail string, lastMessageIncoming bool, ) (finalTo, finalCC, finalBCC []string)
ComputeRecipients computes new recipients using last message's recipients and direction.
func DedupAndExcludeString ¶
DedupAndExcludeString returns a deduplicated []string excluding empty and a specific value.
func ExtractEmail ¶
ExtractEmail extracts the email address from a string.
func FormatDuration ¶
FormatDuration formats a duration as a string.
func GenerateEmailMessageID ¶
GenerateEmailMessageID generates a RFC-compliant Message-ID for an email, does not include the angle brackets. The client is expected to wrap the returned string in angle brackets.
func GetPathFromURL ¶
GetPathFromURL extracts the path from a URL.
func RandomAlphanumeric ¶
RandomAlphanumeric generates a random alphanumeric string of length n.
func RandomNumeric ¶
RandomNumeric generates a random numeric string of length n.
func RemoveEmpty ¶
RemoveEmpty removes empty strings from a slice of strings.
func RemoveItemByValue ¶
RemoveItemByValue removes all instances of a value from a slice of strings.
func ReverseSlice ¶
func ReverseSlice(source []string)
ReverseSlice reverses a slice of strings in place.
func SanitizeFilename ¶
SanitizeFilename sanitizes the provided filename.
func ValidEmail ¶
ValidEmail returns true if it's a valid email else return false.
Types ¶
This section is empty.