lysstring

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2025 License: MIT Imports: 13 Imported by: 1

README

lysstring

String functions.

Documentation

Overview

Package lysstring contains string functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Camel added in v0.1.48

func Camel(s string) (res string)

Camel removes accents and spaces in s and converts it to camel case My string -> myString

func Convert

func Convert(s, inSep, outSep string, f func(string) string) (res string)

Convert changes value separation of s, e.g. from CSV (,) to TSV (|)

func DeAlias added in v0.1.18

func DeAlias[T ~string](in []T) (out []string)

DeAlias converts []T to []string, where T is an alias of string

func FirstLower added in v0.1.48

func FirstLower(s string) string

FirstLower changes the first character of s to lower case from https://stackoverflow.com/questions/75988064/make-first-letter-of-string-lower-case-in-golang

func IsAscii added in v0.1.23

func IsAscii(s string) bool

IsAscii returns true if s only contains ASCII chars from https://stackoverflow.com/questions/53069040/checking-a-string-contains-only-ascii-characters

func Joined added in v0.1.48

func Joined(s string) (res string)

Joined removes accents and spaces in s and converts it to lower case My string -> mystring

func Kebab added in v0.1.48

func Kebab(name string) (res string)

Kebab removes accents in s and changes it to lower case with hyphen separation My string -> my-string

func Pascal added in v0.1.48

func Pascal(s string) (res string)

Pascal removes accents and spaces in s and changes it to Pascal case My string -> MyString

func RandString

func RandString(n int) string

RandString creates a random string of length n from https://stackoverflow.com/questions/22892120/how-to-generate-a-random-string-of-a-fixed-length-in-go

func RemoveCharacters added in v0.1.14

func RemoveCharacters(input string, charsToRemove string) string

RemoveCharacters returns input with the chars in charsToRemove removed from https://socketloop.com/tutorials/golang-remove-characters-from-string-example

func ReplaceAccents added in v0.1.23

func ReplaceAccents(s string) (res string, err error)

ReplaceAccents replaces accent characters such as "é" with their non-accented equivalents such as "e" from https://twin.sh/articles/33/remove-accents-from-characters-in-go contains special handling for German accents

func SingleLine added in v0.1.49

func SingleLine(s string) string

SingleLines removes tabs and excess line breaks from s "a\n\n\tb\n" -> "a\nb" from https://stackoverflow.com/questions/35360080/golang-idiomatic-way-to-remove-a-blank-line-from-a-multi-line-string

func SingleSpace added in v0.1.49

func SingleSpace(s string) string

SingleSpace removes excess tabs and spaces from s " a b " -> "a b" from https://stackoverflow.com/questions/37290693/how-to-remove-redundant-spaces-whitespace-from-a-string-in-golang

func Snake added in v0.1.48

func Snake(s string) (res string)

Snake removes accents in s and changes it to lower case with underscore separation My string -> my_string

func Title

func Title(s string) string

Title returns s in title case using non-specific language rules

Types

This section is empty.

Jump to

Keyboard shortcuts

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