{"modulePath":"github.com/beeper/agentremote","version":"v0.0.3","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package stringutil\n\n## Functions\n\n```go\nfunc BoolPtrOr(ptr *bool, fallback bool) bool\n```\nBoolPtrOr dereferences a \\*bool, returning fallback if the pointer is nil.\n\n```go\nfunc BuildProviderOrder(primary string, fallbacks []string, defaultOrder []string) []string\n```\nBuildProviderOrder constructs a deduplicated provider order list. primary is placed first (unless empty or \"auto\"), followed by fallbacks. If the resulting list is empty, a clone of defaultOrder is returned.\n\n```go\nfunc DedupeStrings(values []string) []string\n```\nDedupeStrings returns a deduplicated copy of values, preserving order. Empty strings and strings that are empty after trimming are skipped.\n\n```go\nfunc EnvOr(existing, value string) string\n```\nEnvOr returns value (trimmed) if non-empty, otherwise returns existing.\n\n```go\nfunc FirstNonEmpty(values ...string) string\n```\nFirstNonEmpty returns the first non-empty string after trimming.\n\n```go\nfunc NormalizeBaseURL(value string) string\n```\nNormalizeBaseURL trims whitespace and trailing slashes from a URL.\n\n```go\nfunc NormalizeElevatedLevel(raw string) (string, bool)\n```\nNormalizeElevatedLevel normalizes a raw elevated-level string to one of the canonical values: \"off\", \"full\", \"ask\", or \"on\". Returns the normalized value and true if recognized, or (\"\", false) for unrecognized input.\n\n```go\nfunc NormalizeEnum(raw string, aliases map[string]string) (string, bool)\n```\nNormalizeEnum normalizes a raw string to a canonical enum value. It lowercases and trims the input, then looks it up in the aliases map. Returns the canonical value and true if found, or (\"\", false) if not.\n\n```go\nfunc NormalizeMimeType(mimeType string) string\n```\nNormalizeMimeType lowercases, trims whitespace, and strips parameters from a MIME type.\n\n```go\nfunc SplitCSV(value string) []string\n```\nSplitCSV splits a comma-separated string into trimmed, non-empty parts.\n\n```go\nfunc StringValue(v any) string\n```\nStringValue extracts a string from a dynamic value. Handles string and fmt.Stringer; returns \"\" for anything else.\n\n```go\nfunc StripMarkup(text string) string\n```\nStripMarkup removes common HTML/markdown formatting that models might wrap tokens in.\n\n```go\nfunc TrimDefault(value, fallback string) string\n```\nTrimDefault returns value (trimmed) if non-empty, otherwise returns fallback.\n\n```go\nfunc TrimString(v any) string\n```\nTrimString extracts a string from a dynamic value and trims whitespace.\n\n```go\nfunc Truncate(s string, maxLen int) string\n```\nTruncate returns s unchanged if its length does not exceed maxLen. Otherwise it returns the first maxLen bytes followed by \"...\".\n\n","path":"github.com/beeper/agentremote/pkg/shared/stringutil","name":"stringutil","synopsis":"","isRedistributable":true}
