123456789101112131415161718192021 |
- package utils
- import (
- "strings"
- )
- // ParseTagOption parse tag options to hash
- func ParseTagOption(str string) map[string]string {
- tags := strings.Split(str, ";")
- setting := map[string]string{}
- for _, value := range tags {
- v := strings.Split(value, ":")
- k := strings.TrimSpace(strings.ToUpper(v[0]))
- if len(v) == 2 {
- setting[k] = v[1]
- } else {
- setting[k] = k
- }
- }
- return setting
- }
|