Skip to content

gouniverse/strutils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

String Utils Open in Gitpod

tests

  • Base64Decode(text []byte) (data []byte, err error) - decodes base64 text to binary data.
  • Base64Encode(data []byte) (text []byte) - encodes binary data to base64 encoded text.
  • Base32ExtendedDecode(data []byte) string - decodes binary data to base32 extended (RFC 4648) encoded text.
  • Base32ExtendedEncode(data []byte) string - encodes binary data to base32 extended (RFC 4648) encoded text.
  • BcryptHashCompare(str string) bool - compares the string to a bcrypt hash
  • >Between(str string, startNeedle string, endNeedle string) (result string, found bool) - returns the substring between two needles
  • ContainsAnyChar(str string, charset string) bool - returns true if the string contains any of the characters in the specified charset
  • ContainsOnly(str string, charset string) bool - returns true is the string contains only charcters from the specified charset
  • IntToBase32(num int) string
  • IntToBase36(num int) string
  • LeftFrom(s string, needle, string) string - returns the substring on the left side of the needle
  • LeftPad(s string, padStr string, overallLen int) string
  • StrRightFrom(s string, needle, string) string - returns the substring on the right side of the needle
  • RightPad(s string, padStr string, overallLen int) string
  • Slugify(str string) string
  • ToBcryptHash(str string) string - converts the string to BCrypt hash, use BcryptHashCompare to check
  • ToBytes(s string) []byte - converts string to bytes
  • ToCamel(str string) string - converts the given string to camel case
  • ToSnake(str string) string - converts the given string to snake case
  • UcFirst(str string) string - convert first letter into upper case