wordUtils

package
v0.0.0-...-2e001e6 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package wordUtils provides some string utilities regarding words.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Capitalize

func Capitalize(str string) string

Capitalize capitalizes all the whitespace separated words in a String. Only the first letter of each word is changed.

func CapitalizeDelimited

func CapitalizeDelimited(str string, delimiters ...string) string

CapitalizeDelimited capitalizes all the delimiter separated words in a String. Only the first letter of each word is changed. To convert the rest of each word to lowercase at the same time.

The delimiters represent a set of characters understood to separate words. The first string character and the first non-delimiter character after a delimiter will be capitalized.

func ContainsAllWords

func ContainsAllWords(str string, words ...string) bool

ContainsAllWords checks if the String contains all words.

func Initials

func Initials(str string) string

Initials extracts the initial letters from each word in the String.

The first letter of the string and all first letters after the defined delimiters are returned as a new string. Their case is not changed.

func InitialsDelimited

func InitialsDelimited(str string, delimiters ...string) string

InitialsDelimited extracts the initial letters from each word in the String.

The first letter of the string and all first letters after the defined delimiters are returned as a new string. Their case is not changed.

func SwapCase

func SwapCase(str string) string

SwapCase swaps the case of a String using a word based algorithm.

Upper case character converts to Lower case. Title case character converts to Lower case. Lower case character after Whitespace or at start converts to Title case. Other Lower case character converts to Upper case.

func Uncapitalize

func Uncapitalize(str string) string

Uncapitalize uncapitalizes all the whitespace separated words in a string. Only the first letter of each word is changed.

func UncapitalizeDelimited

func UncapitalizeDelimited(str string, delimiters ...string) string

UncapitalizeDelimited uncapitalizes all the whitespace separated words in a String. Only the first letter of each word is changed.

The delimiters represent a set of characters understood to separate words. The first string character and the first non-delimiter character after a delimiter will be uncapitalized.

Types

This section is empty.

Jump to

Keyboard shortcuts

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