stringutil

package
v0.0.0-...-cc86db0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupJSONField

func CleanupJSONField(field string) string

CleanupJSONField converts a text to a json friendly text as follows: - converts multi-line fields to single line by removing all but the first line - escapes special characters - truncates remaining line to length no more than maxSummaryLength

func CleanupNewLines

func CleanupNewLines(s string) string

func ReplaceMarkedFields

func ReplaceMarkedFields(str, startMarker, endMarker string, fieldReplacer func(string) string) (newStr string, err error)

ReplaceMarkedFields finds substrings delimited by the start and end markers, removes the markers, and replaces the text between the markers with the result of calling the fieldReplacer function on that text substring. For example, if the input string is: "a string with <a>text</a> marked" the startMarker is: "<a>" the end marker is: "</a>" and fieldReplacer is: strings.ToUpper then the output will be: "a string with TEXT marked"

Types

This section is empty.

Jump to

Keyboard shortcuts

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