Documentation
¶
Overview ¶
Package textutils provides common helper functions for text manipulation or output used by applications in this module.
Index ¶
- Constants
- func CharsWithinRange(s string, start rune, end rune) bool
- func InList(needle string, haystack []string, ignoreCase bool) bool
- func InspectString(s string, w io.Writer) error
- func InspectStrings(ss []string, w io.Writer) error
- func ReplaceAstralUnicode(s string, r string) string
- func ReplaceTextileFormatCharacters(s string) string
- func ReplaceUsingSubMap(s string, substMap map[rune]string) string
- func WithinUTF8MB3Range(s string) bool
Constants ¶
const ( UTF8MB3RangeStartRune rune = '\u0000' UTF8MB3RangeStartInt int = 0 UTF8MB3RangeEndRune rune = '\uFFFF' UTF8MB3RangeEndInt int = 65535 )
Start and end Unicode code points for the UTF8MB3 character set. https://en.wikibooks.org/wiki/Unicode/Character_reference/0000-0FFF https://en.wikibooks.org/wiki/Unicode/Character_reference/F000-FFFF
const ( UTF8MB4RangeStartRune rune = '\U00010000' UTF8MB4RangeStartInt int = 65536 UTF8MB4RangeEndRune rune = '\U0010FFFF' UTF8MB4RangeEndInt int = 1114111 )
Start and end Unicode code points for the UTF8MB4 character set. https://en.wikibooks.org/wiki/Unicode/Character_reference/10000-10FFF https://en.wikibooks.org/wiki/Unicode/Character_reference/F0000-10FFFF
const ( EmojiScissors string = "\xE2\x9C\x82" EmojiNoEntry string = "\xE2\x9B\x94" EmojiRecycle string = "\xE2\x99\xBB" EmojiSunWithFace string = "\xF0\x9F\x8C\x9E" EmojiHeavyCheckMark string = "\xE2\x9C\x85" EmojiCrossMark rune = '\u274C' EmojiCheckMark rune = '\u2714' EmojiOKButton rune = '\U0001F197' )
common Emoji characters used by this project. Not all are UTF8MB3 compatible.
Variables ¶
This section is empty.
Functions ¶
func CharsWithinRange ¶ added in v0.3.0
CharsWithinRange indicates whether a provided string contains any characters outside of the provided character set range.
func InList ¶
InList is a helper function to emulate Python's `if "x" in list:` functionality. The caller can optionally ignore case of compared items.
func InspectString ¶ added in v0.3.2
InspectString generates a summary table from a provided string to help identify Unicode characters incompatible with older database character sets (e.g., UTF8MB3). This summary table is written to the provided io.Writer interface.
func InspectStrings ¶ added in v0.3.0
InspectStrings generates a summary table from a provided slice of strings to help identify Unicode characters incompatible with older database character sets (e.g., UTF8MB3). This summary table is written to the provided io.Writer interface.
func ReplaceAstralUnicode ¶ added in v0.3.0
ReplaceAstralUnicode accepts an original string and a replacement string. For every Unicode code point found in the original string that is outside of the range of UTF8MB3, the replacement string is used in its place. A modified copy of the original string is returned.
func ReplaceTextileFormatCharacters ¶ added in v0.4.0
ReplaceTextileFormatCharacters accepts an original string and uses the ReplaceUsingSubMap function to replace any characters specific to Textile formatting. A modified copy of the original string is returned.
func ReplaceUsingSubMap ¶ added in v0.4.0
ReplaceUsingSubMap accepts an original string and a map of character replacements. For every matching character found in the original string a replacement string (e.g, an HTML entity value) from the map is used in its place. A modified copy of the original string is returned.
func WithinUTF8MB3Range ¶ added in v0.3.0
WithinUTF8MB3Range indicates whether a provided string contains any characters outside of the UTF8MB3 character set range.
Types ¶
This section is empty.