TruncateLabel whitespace-normalizes and truncates text to maxLen runes. Returns "" if input is empty or whitespace-only.
(text string, maxLen int)
| 25 | // TruncateLabel whitespace-normalizes and truncates text to maxLen runes. |
| 26 | // Returns "" if input is empty or whitespace-only. |
| 27 | func TruncateLabel(text string, maxLen int) string { |
| 28 | normalized := strings.TrimSpace(whitespaceRun.ReplaceAllString(text, " ")) |
| 29 | if normalized == "" { |
| 30 | return "" |
| 31 | } |
| 32 | return stringutil.Truncate(normalized, maxLen, stringutil.TruncateWithEllipsis) |
| 33 | } |
| 34 | |
| 35 | // SeedSummary builds a base summary map with a first_message label. |
| 36 | // Returns nil if label is empty. |
no outgoing calls