str

package
v0.0.0-...-381b1be Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 9 Imported by: 0

README

str

-- import "github.com/dockerian/go-coding/pkg/str"

Package str :: conv.go - extended string formatter functions

Package str :: palindrome.go

Package str :: str.go - extended string functions

Usage

func Append
func Append(slice, data []byte) []byte

Append concatenates byte slices

func FormatNumber
func FormatNumber(number uint64) string

FormatNumber returns a comma delimited decimal string

func FromNumber
func FromNumber(number uint64) string

FromNumber returns an English words representation for a number. ex. 1024 => "one thousand twenty four"

func GetPalindromicSubstring
func GetPalindromicSubstring(str string) string

GetPalindromicSubstring returns the longest palindromic substring

func IndentJSON
func IndentJSON(data interface{}, indent string) string

IndentJSON formats data object with indented JSON string.

func IsPalindrome
func IsPalindrome(input interface{}) (bool, error)

IsPalindrome checks if interface{} is palindrome

func IsPalindromeNumber
func IsPalindromeNumber(input uint64) bool

IsPalindromeNumber checks if an input number is palindrome

func IsPalindromePhase
func IsPalindromePhase(input string) bool

IsPalindromePhase checks if an input string is palindrome phase

func IsPalindromeString
func IsPalindromeString(input string) bool

IsPalindromeString checks if an input string is palindrome

func ReplaceProxyURL
func ReplaceProxyURL(url, prefix, proxyURL string) string

ReplaceProxyURL searches prefix in url and replaces with proxyURL

func StringIn
func StringIn(stringInput string, stringList []string, options ...bool) bool

StringIn check if an input is in an array of strings; optional to ignore case

func ToCamel
func ToCamel(in string, keepAllCaps ...bool) string

ToCamel converts a string to camel case format

func ToSnake
func ToSnake(in string) string

ToSnake converts a string to snake case format with unicode support See also https://github.com/serenize/snaker/blob/master/snaker.go

func TranslateNumber
func TranslateNumber(number uint64, xFunc TranslateFunc) string

TranslateNumber translates a number to string by specific function.

func TranslateTo
func TranslateTo(lang string, number uint64) string

TranslateTo returns a string representation of number by specific language.

type Palindrome
type Palindrome interface {
	GetData() string
	IsPalindrome() bool
}

Palindrome interface

type PalindromeNumber
type PalindromeNumber struct {
}

PalindromeNumber struct

func (*PalindromeNumber) GetData
func (p *PalindromeNumber) GetData() string

GetData returns input data

func (*PalindromeNumber) IsPalindrome
func (p *PalindromeNumber) IsPalindrome() bool

IsPalindrome checks if an input number is palindrome

type PalindromeString
type PalindromeString struct {
}

PalindromeString struct

func (*PalindromeString) GetData
func (p *PalindromeString) GetData() string

GetData returns input data

func (*PalindromeString) GetSubstring
func (p *PalindromeString) GetSubstring() string

GetSubstring returns the longest palindromic substring

func (*PalindromeString) IsPalindrome
func (p *PalindromeString) IsPalindrome() bool

IsPalindrome checks if an input string is palindrome

func (*PalindromeString) IsPalindromePhase
func (p *PalindromeString) IsPalindromePhase() bool

IsPalindromePhase checks if an input string is palindrome phase

type TranslateFunc
type TranslateFunc func(uint64) string

TranslateFunc defines a type of function to translate number (uint64) to string.

Documentation

Overview

Package str :: conv.go - extended string formatter functions

Package str :: palindrome.go

Package str :: str.go - extended string functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Append

func Append(slice, data []byte) []byte

Append concatenates byte slices

func FormatNumber

func FormatNumber(number uint64) string

FormatNumber returns a comma delimited decimal string

func FromNumber

func FromNumber(number uint64) string

FromNumber returns an English words representation for a number. ex. 1024 => "one thousand twenty four"

func GetPalindromicSubstring

func GetPalindromicSubstring(str string) string

GetPalindromicSubstring returns the longest palindromic substring

func IndentJSON

func IndentJSON(data interface{}, indent string) string

IndentJSON formats data object with indented JSON string.

func IsPalindrome

func IsPalindrome(input interface{}) (bool, error)

IsPalindrome checks if interface{} is palindrome

func IsPalindromeNumber

func IsPalindromeNumber(input uint64) bool

IsPalindromeNumber checks if an input number is palindrome

func IsPalindromePhase

func IsPalindromePhase(input string) bool

IsPalindromePhase checks if an input string is palindrome phase

func IsPalindromeString

func IsPalindromeString(input string) bool

IsPalindromeString checks if an input string is palindrome

func ReplaceProxyURL

func ReplaceProxyURL(url, prefix, proxyURL string) string

ReplaceProxyURL searches prefix in url and replaces with proxyURL

func StringIn

func StringIn(stringInput string, stringList []string, options ...bool) bool

StringIn check if an input is in an array of strings; optional to ignore case

func ToCamel

func ToCamel(in string, keepAllCaps ...bool) string

ToCamel converts a string to camel case format

func ToSnake

func ToSnake(in string) string

ToSnake converts a string to snake case format with unicode support See also https://github.com/serenize/snaker/blob/master/snaker.go

func TranslateNumber

func TranslateNumber(number uint64, xFunc TranslateFunc) string

TranslateNumber translates a number to string by specific function.

func TranslateTo

func TranslateTo(lang string, number uint64) string

TranslateTo returns a string representation of number by specific language.

Types

type Palindrome

type Palindrome interface {
	GetData() string
	IsPalindrome() bool
}

Palindrome interface

type PalindromeNumber

type PalindromeNumber struct {
	// contains filtered or unexported fields
}

PalindromeNumber struct

func (*PalindromeNumber) GetData

func (p *PalindromeNumber) GetData() string

GetData returns input data

func (*PalindromeNumber) IsPalindrome

func (p *PalindromeNumber) IsPalindrome() bool

IsPalindrome checks if an input number is palindrome

type PalindromeString

type PalindromeString struct {
	// contains filtered or unexported fields
}

PalindromeString struct

func (*PalindromeString) GetData

func (p *PalindromeString) GetData() string

GetData returns input data

func (*PalindromeString) GetSubstring

func (p *PalindromeString) GetSubstring() string

GetSubstring returns the longest palindromic substring

func (*PalindromeString) IsPalindrome

func (p *PalindromeString) IsPalindrome() bool

IsPalindrome checks if an input string is palindrome

func (*PalindromeString) IsPalindromePhase

func (p *PalindromeString) IsPalindromePhase() bool

IsPalindromePhase checks if an input string is palindrome phase

type TranslateFunc

type TranslateFunc func(uint64) string

TranslateFunc defines a type of function to translate number (uint64) to string.

Jump to

Keyboard shortcuts

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