Documentation
¶
Index ¶
- Constants
- func ContainLetters(v string) bool
- func ContainNumber(v string) bool
- func ContainNumbers(v string) bool
- func ContainNumbersAndLetters(v string) (r bool)
- func Contains(v string, strs ...string) bool
- func CutString(str, initial, final string, n int) (strOut string)
- func ExtractValue(body string, key string) string
- func Format(v, format string) (result string)
- func GetDiff(str1, str2 string) (strOut string)
- func GetFilenameFromPath(p string) string
- func GetFilenameWithoutExtension(v string) string
- func GetLastCharacter(v string, count int) (r string)
- func GetNotZeroValue(p ...string) string
- func GetPathFromFullFilename(v string) string
- func GetStringBetween(str, initial, final string, includeInitialAndFinal bool) (strOut string)
- func GetStringBetweenAll(str, initial, final string, includeInitialAndFinal bool) (strOut string)
- func GetUriFromUrl(urlString string) string
- func IsInt(url string) bool
- func IsOnlyNumbers(v string) bool
- func IsUrl(url string) bool
- func LowerNoSpaceNoAccent(v string) string
- func NoSpaceNoAccent(v string) string
- func OnlyNumbers(v string) string
- func PointerToString(str *string) string
- func RandString(n int, chars string) (r string)
- func RemoveAccent(v string) string
- func RemoveExtraSpaces(v string) string
- func ReplaceAtIndex(in string, char rune, idx int) string
- func ReplaceSpecialCharacters(v ...string) (result string)
- func StrPad(input string, padLength int, padString string, padType string) string
- func StrPadRight(input string, padLength int, padString string) string
- func StringInSlice(a string, list ...string) bool
- func StringPToUint(v *string) uint
- func ToCamel(v string) string
- func ToLowerCamelCase(v string) (result string)
- func ToSnakeCase(str string) string
- func ToString(str interface{}) string
- func TrimAll(v string) string
- func UpperNoSpaceNoAccent(v string) string
- func Uuid() string
- func WordCount(v string) int
- type RandStringChars
Constants ¶
const ( FormatCpf string = "###.###.###-##" FormatCnpj string = "##.###.###/####-##" FormatCreditCard string = "####.####.####.####" MaskCreditCard string = "****.****.****-####" )
const ( RegexOnlyLetters = "[^A-Z]" RegexOnlyNumbers = "[^0-9]" )
Variables ¶
This section is empty.
Functions ¶
func ContainLetters ¶
ContainLetters verifica se a string passada contem letras entre os caracteres
func ContainNumber ¶
ContainNumber verifica se uma string contem numeros
func ContainNumbers ¶
ContainNumbers verifica se a string passada contem numeros entre os caracteres
func ContainNumbersAndLetters ¶
ContainNumbersAndLetters verifica se a string passada contem letras e numeros ao mesmo tempo
func CutString ¶
CutString remove parte do texto de acordo com o inicio e fim da sequencia informados, retornando o texto atualizado
func ExtractValue ¶
func Format ¶
Format essa funcao tem como objetivo mascarar strings em um determinado formato, o caractere # será substituído pelo valor subsequente da string, o caractere * a funcao entende como uma mascara em si, ou seja, ela conta os caracteres
func GetFilenameFromPath ¶
GetFilenameFromPath return filename given the path(url or local path)
func GetFilenameWithoutExtension ¶
GetFilenameWithoutExtension returns the filename without extension of given path
func GetLastCharacter ¶
GetLastCharacter retorna os ultimos x/count caracteres de uma string
func GetNotZeroValue ¶
GetNotZeroValue dado um array de valores string, é retornado o que tem valor nao zerovalue
func GetPathFromFullFilename ¶
GetPathFromFilename get only the path of the whole path passed by parameter, it returns path without filename
func GetStringBetween ¶
GetStringBetween retorna a string que está entre a string inicial e final passada como parametro, caso nao encontre, retorne uma string vazia
func GetStringBetweenAll ¶
GetStringBetweenAll Returns all strings between the start and end strings
func GetUriFromUrl ¶
GetUriFromUrl retorna uma URI dado uma URL
func IsOnlyNumbers ¶
func LowerNoSpaceNoAccent ¶
LowerNoSpaceNoAccent apply 3 steps over string, transform to lowercase, remove duplicate spaces and remove accents
func NoSpaceNoAccent ¶
NoSpaceNoAccent remove all the spaces of the given string, begin, end and middle of the string
func OnlyNumbers ¶
OnlyNumbers returns only numbers given a string
func PointerToString ¶
PointerToString convert string pointer to string as Zero value if pointer is nil
func RandString ¶
RandString generate a random string Use the constants RandStringCharsOnlyNumbers, RandStringCharsOnlyLetters and RandStringCharsLettersAndNumbers to facilitate to pass the type of character you'd like to generate limit the number of characters at 250
func RemoveAccent ¶
RemoveAccent remove all accents from given string
func RemoveExtraSpaces ¶
RemoveExtraSpaces remove all duplicated spaces over whole string
func ReplaceAtIndex ¶
ReplaceAtIndex altera um caractere em uma string baseado no index da mesma
func ReplaceSpecialCharacters ¶
ReplaceSpecialCharacters substitui todos os caracteres especiais do primeiro parametro pelo valor informado no
segundo parametro. Se o segundo parametro nao for informado, os caracteres serão apenas removidos. A partir do terceiro parametro sao consideradas excessoes a regra caso necessario. Ex: ReplaceSpecialCharacters("_teste!") saida: teste ReplaceSpecialCharacters("_teste!", "@") saida: @teste@ ReplaceSpecialCharacters("_teste!", "@", "!") saida: @teste!
func StrPad ¶
StrPad returns the input string padded on the left, right or both sides using padType to the specified padding length padLength.
Example: input := "Codes"; StrPad(input, 10, " ", "RIGHT") // produces "Codes " StrPad(input, 10, "-=", "LEFT") // produces "=-=-=Codes" StrPad(input, 10, "_", "BOTH") // produces "__Codes___" StrPad(input, 6, "___", "RIGHT") // produces "Codes_" StrPad(input, 3, "*", "RIGHT") // produces "Codes"
func StrPadRight ¶
StrPadRight adicionar `padLength` quantidade de caracteres a direita de uma string
func StringInSlice ¶
StringInSlice check if certain string contain in slice
func StringPToUint ¶
StringPToUint convert string pointer to uint, returns zero if pointer is nil
func ToLowerCamelCase ¶
func ToSnakeCase ¶
func UpperNoSpaceNoAccent ¶
UpperNoSpaceNoAccent apply 3 steps over string, transform to uppercase, remove duplicate spaces and remove accents
Types ¶
type RandStringChars ¶
type RandStringChars string
const RandStringCharsAllLettersAndNumbers RandStringChars = `0123456789ABCDEFGHIJKLMNOPQRSTUVW` +
`XYZabcdefghijklmnopqrstuvwxyz`
const RandStringCharsLettersAndNumbers RandStringChars = "abcdefghijklmnopqrstuvwxyz0123456789"
const RandStringCharsOnlyLetters RandStringChars = "abcdefghijklmnopqrstuvwxyz"
const RandStringCharsOnlyNumbers RandStringChars = "0123456789"
func (RandStringChars) String ¶
func (r RandStringChars) String() string