Documentation ¶
Index ¶
- func Clean(s string) string
- func CleanAndTruncate(s string, max int) string
- func FirstLetter(s string, max int) string
- func FirstToUpper(text string) string
- func IsTrue(value interface{}) bool
- func IsTwitterUrl(twitterUrl string) bool
- func IsUrl(stringUrl string) bool
- func NanoId(length ...int) string
- func NanoIdStr(str string, length int) string
- func NumberSize(bytes float64, precision int) string
- func ParseUrl(s string) (string, error)
- func SeparateNumber(number float64, tags ...language.Tag) string
- func Slug(s string) string
- func Ternary[D any](cond bool, ifTrue D, ifFalse D) D
- func Truncate(s string, max int) string
- func UUID() string
- func Ucwords(s string) string
- func Ulid() string
- func ValidateEmail(e string) bool
- type NumberFormatType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanAndTruncate ¶
Clean HTML format and truncate string
func FirstLetter ¶
Parse string to first letter uppercase
Example: "Hello world" => "HM"
If max is less than 1, function return all first letter of strings
func ParseUrl ¶
Parse raw URL to clean URL
Example: "https://portalnesia.com/contact" => "portalnesia.com/contact"
func Truncate ¶
Truncate string
Example: "lorem ipsum lorem ipsum lorem ipsum" => "lorem ipsum lor..."
Types ¶
type NumberFormatType ¶
func NumberFormatShort ¶
func NumberFormatShort(n int64) NumberFormatType
Format integer to K,M,B,T format
Example: 64768456 => "64.77 M"
Click to show internal directories.
Click to hide internal directories.