Documentation
¶
Index ¶
- func IndentTextWithMaxLength(text, indent string, maxTextLineCharWidth int, isIndentFirstLine bool) string
- func LastNLines(s string, n int) string
- func MaxFirstCharsWithDots(inStr string, maxCharCount int) string
- func MaxLastCharsWithDots(inStr string, maxCharCount int) string
- func ReadFirstLine(s string, isIgnoreLeadingEmptyLines bool) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IndentTextWithMaxLength ¶
func IndentTextWithMaxLength(text, indent string, maxTextLineCharWidth int, isIndentFirstLine bool) string
IndentTextWithMaxLength formats text with indentation and wraps lines longer than maxTextLineCharWidth. Each line is prefixed with indent string. If isIndentFirstLine is false, the first line will not be indented.
func LastNLines ¶
LastNLines returns the last n lines from the input string. It trims leading and trailing newlines before splitting. If the string has fewer than n lines, returns all lines.
func MaxFirstCharsWithDots ¶
MaxFirstCharsWithDots returns the first maxCharCount characters from inStr. If the string is longer than maxCharCount, it appends "..." to indicate truncation. Returns empty string if maxCharCount < 4.
func MaxLastCharsWithDots ¶
MaxLastCharsWithDots returns the last maxCharCount characters from inStr. If the string is longer than maxCharCount, it prepends "..." to indicate truncation. Returns empty string if maxCharCount < 4.
func ReadFirstLine ¶
ReadFirstLine returns the first line from the input string. If isIgnoreLeadingEmptyLines is true, it skips empty lines and returns the first non-empty line.
Types ¶
This section is empty.