strings

package
v0.0.0-...-83bedeb Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package strings contains utilities for working with strings in Go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TruncateUTF8

func TruncateUTF8(s string, limit int) string

TruncateUTF8 truncates the given string to make sure it uses less than limit bytes. If the last code point is an utf8 code point that would be split, it removes it entirely to make sure the resulting string is not broken.

This function may still split characters that are comprised of more than one valid utf8 code point, like many emoji, however the resulting string will still be valid utf8. Example: The "Flag: United States emoji" is a flag sequence combining

🇺 Regional Indicator Symbol Letter U
🇸 Regional Indicator Symbol Letter S

Types

This section is empty.

Jump to

Keyboard shortcuts

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