stringsx

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: BSD-3-Clause Imports: 3 Imported by: 4

Documentation

Overview

Package stringsx provides additional string functions beyond those in the standard strings package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteSplitLines added in v0.3.0

func ByteSplitLines(s []byte) [][]byte

ByteSplitLines is a windows-safe version of bytes.Split(s, "\n") that removes any trailing \r carriage returns from the split lines.

func ByteTrimCR added in v0.3.0

func ByteTrimCR(s []byte) []byte

ByteTrimCR returns the byte string without any trailing \r carriage return

func InsertFirstUnique added in v0.2.1

func InsertFirstUnique(strs *[]string, str string, max int)

InsertFirstUnique inserts the given string at the start of the given string slice while keeping the overall length to the given max value. If the item is already on the list, then it is moved to the top and not re-added (unique items only). This is useful for a list of recent items.

func SplitLines

func SplitLines(s string) []string

SplitLines is a windows-safe version of strings.Split(s, "\n") that removes any trailing \r carriage returns from the split lines.

func TrimCR added in v0.3.0

func TrimCR(s string) string

TrimCR returns the string without any trailing \r carriage return

func UniqueList added in v0.3.8

func UniqueList(strs []string) []string

UniqueList removes duplicates from given string list, preserving the order.

Types

This section is empty.

Jump to

Keyboard shortcuts

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