str

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package str @Description:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func After

func After(subject string, search string) string

After @Description:Return the remainder of a string after the first occurrence of a given value. @param subject @param search @return string

func AfterLast

func AfterLast(subject string, search string) string

AfterLast @Description:Return the remainder of a string after the last occurrence of a given value. @param subject @param search @return string

func Before

func Before(subject string, search string) string

Before @Description:Get the portion of a string before the first occurrence of a given value. @param subject @param search @return string

func BeforeLast

func BeforeLast(subject string, search string) string

BeforeLast @Description:Get the portion of a string before the last occurrence of a given value. @param subject @param search @return string

func Between

func Between(subject string, from string, to string) string

Between @Description:Get the portion of a string between two given values. @param subject @param from @param to @return string

func BetweenFirst

func BetweenFirst(subject string, from string, to string) string

BetweenFirst @Description:Get the smallest possible portion of a string between two given values. @param subject @param from @param to @return string

func Camel

func Camel(value string) (response string)

Camel @Description: Convert a value to camel case. @param value @return response

func Contains

func Contains(haystack string, needles string, ignoreCase bool) bool

Contains @Description:Determine if a given string contains a given substring. @param haystack @param needles @param ignoreCase @return bool

func ContainsAll

func ContainsAll(haystack string, needles []string, ignoreCase bool) bool

ContainsAll @Description:Determine if a given string contains all array values. @param haystack @param needles @param ignoreCase @return bool

func ContainsAny

func ContainsAny(haystack string, needles []string, ignoreCase bool) bool

ContainsAny @Description:Determine if a given string contains any one in array values. @param haystack @param needles @param ignoreCase @return bool

func E

func E(value string) string

E @Description: Encode HTML special characters in a string. @param value @return string

func EndsWith

func EndsWith(haystack string, needles string) bool

EndsWith @Description: Determine if a given string ends with a given substring. @param haystack @param needles @return bool

func Excerpt

func Excerpt(text string, phrase string, options map[string]string) (response string)

Excerpt @Description: Extracts an excerpt from text that matches the first instance of a phrase. @param text @param phrase @param options @return response

func Finish

func Finish(value string, cap string) string

Finish @Description:Cap a string with a single instance of a given value. @param value @param cap @return string

func Headline

func Headline(value string) (response string)

Headline @Description: Convert the given string to title case for each word. @param value @return response

func Is

func Is(pattern string, value string) bool

Is @Description:Determine if a given string matches a given pattern. @param pattern @param value @return bool

func IsAscii

func IsAscii(value string) bool

IsAscii @Description:Determine if a given string is 7 bit ASCII. @param value @return bool

func Kebab

func Kebab(value string) (response string)

Kebab @Description: Convert a string to kebab case. @param value @return response

func LcFirst

func LcFirst(value string) string

LcFirst @Description: Make a string's first character lowercase. @param value @return string

func Length

func Length(value string) int

Length @Description: @param value @return int

func Limit

func Limit(value string, limit int, end string) string

Limit @Description: the number of characters in a string. @param value @param limit @param end @return string

func Lower

func Lower(value string) string

Lower @Description:the given string to lower-case. @param value @return string

func Mask

func Mask(subject string, character string, index int, length int) string

Mask @Description: Masks a portion of a string with a repeated character. @param subject @param character @param index @param length @return string

func PadBoth

func PadBoth(value string, length int, pad string) (response string)

PadBoth @Description: Pad both sides of a string with another. @param value @param length @param pad @return response

func PadLeft

func PadLeft(value string, length int, pad string) string

PadLeft @Description:Pad the left side of a string with another. @param value @param length @param pad @return string

func PadRight

func PadRight(value string, length int, pad string) string

PadRight @Description:Pad the right side of a string with another. @param value @param length @param pad @return string

func Random

func Random(length int) string

Random @Description:Generate a more truly "random" alpha-numeric string. @param length @return string

func RegularReplaceArray

func RegularReplaceArray(pattern string, replacements []string, subject string) string

RegularReplaceArray @Description: Replace a given pattern with each value in the array in sequentially. @param pattern @param replacements @param subject @return string

func Remove

func Remove(search string, subject string, caseSensitive bool) (response string)

Remove @Description:Remove any occurrence of the given string in the subject. @param search @param subject @param caseSensitive @return string

func Replace

func Replace(search string, replace string, subject string) string

Replace @Description:the given value in the given string @param search @param replace @param subject

func ReplaceArray

func ReplaceArray(search string, replace []string, subject string) string

ReplaceArray @Description: Replace a given value in the string sequentially with an array. @param search @param replace @param subject @return string

func ReplaceFirst

func ReplaceFirst(search string, replace string, subject string) string

ReplaceFirst @Description:Replace the first occurrence of a given value in the string. @param search @param replace @param subject @return string

func ReplaceLast

func ReplaceLast(search string, replace string, subject string) string

ReplaceLast @Description:Replace the last occurrence of a given value in the string. @param search @param replace @param subject @return string

func ReplaceOfArraySearch

func ReplaceOfArraySearch(search []string, replace string, subject string) (response string)

ReplaceOfArraySearch @Description:replace the given array value in the given string. @param search @param replace @param subject @return response

func Reverse

func Reverse(value string) string

Reverse @Description:Reverse the given string. @param value @return string

func Snake

func Snake(value string) (response string)

Snake @Description:Convert a string to kebab case. @param value @return response

func SnakeOfCustom

func SnakeOfCustom(value string, delimiter string) (response string)

SnakeOfCustom @Description: Convert a string to kebab case. @param value @param delimiter @return response

func Start

func Start(value string, prefix string) string

Start @Description:Begin a string with a single instance of a given value. @param value @param prefix @return string

func StartsWith

func StartsWith(haystack string, needles string) bool

StartsWith @Description:Determine if a given string starts with a given substring. @param haystack @param needles @return bool

func Studly

func Studly(value string) (response string)

Studly @Description: Convert a value to studly caps case. @param value @return string

func Substr

func Substr(subject string, start int, length int) string

Substr @Description:Returns the portion of the string specified by the start and length parameters. @param subject @param start @param length @return string

func SubstrCount

func SubstrCount(haystack string, needle string) int

SubstrCount @Description: Returns the number of substring occurrences. @param haystack @param needle @return int

func SubstrReplace

func SubstrReplace(subject string, replace string, offset int, length int) string

SubstrReplace @Description:Replace text within a portion of a string. @param subject @param replace @param offset @param length @return string

func Swap

func Swap(swapMap map[string]string, subject string) string

Swap @Description: Swap multiple keywords in a string with other keywords. @param swapMap @param subject @return string

func UcFirst

func UcFirst(value string) string

UcFirst @Description:Make a string's first character uppercase. @param value @return string

func Upper

func Upper(value string) string

Upper @Description:Convert the given string to upper-case. @param value @return string

Types

This section is empty.

Jump to

Keyboard shortcuts

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