1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- package utils
- import (
- uuid "github.com/satori/go.uuid"
- "strings"
- )
- func AllBlank(str ...string) bool {
- for _, s := range str {
- if !IsStringEmpty(s) {
- return false
- }
- }
- return true
- }
- func HasBlank(str ...string) bool {
- for _, s := range str {
- if strings.Trim(s, " ") == "" {
- return true
- }
- }
- return false
- }
- func HasText(str ...string) bool {
- for _, s := range str {
- if strings.Trim(s, " ") != "" {
- return true
- }
- }
- return false
- }
- func IsStringEmpty(s string) bool {
- return strings.Trim(s, " ") == ""
- }
- func IsStringNotEmpty(s string) bool {
- return strings.Trim(s, " ") != ""
- }
- func GetUUID() string {
- return uuid.NewV4().String()
- }
- func SimpleUUID() string {
- return strings.ReplaceAll(GetUUID(), "-", "")
- }
- func GenerateUpperLetters(length int) []string {
- var str []string
- for i := 0; i < length; i++ {
- str = append(str, string(rune('A'+i)))
- }
- return str
- }
- func GenerateLowerLetters(length int) []string {
- var str []string
- for i := 0; i < length; i++ {
- str = append(str, string(rune('a'+i)))
- }
- return str
- }
|