Code optimized (#523)
* optimized markdown generator * optimized markdown generator * optimized markdown generator * add more comment * add comment * add comment * add comments for rpc tool * add comments for model tool * add comments for model tool * add comments for model tool * add comments for config tool * add comments for config tool * add comments * add comments * add comments * add comments * add comment * remove rpc main head info * add comment * optimized Co-authored-by: anqiansong <anqiansong@xiaoheiban.cn>
This commit is contained in:
@@ -2,6 +2,8 @@ package util
|
||||
|
||||
import "strings"
|
||||
|
||||
// Title returns a string value with s[0] which has been convert into upper case that
|
||||
// there are not empty input text
|
||||
func Title(s string) string {
|
||||
if len(s) == 0 {
|
||||
return s
|
||||
@@ -10,6 +12,8 @@ func Title(s string) string {
|
||||
return strings.ToUpper(s[:1]) + s[1:]
|
||||
}
|
||||
|
||||
// Untitle returns a string value with s[0] which has been convert into lower case that
|
||||
// there are not empty input text
|
||||
func Untitle(s string) string {
|
||||
if len(s) == 0 {
|
||||
return s
|
||||
@@ -18,6 +22,7 @@ func Untitle(s string) string {
|
||||
return strings.ToLower(s[:1]) + s[1:]
|
||||
}
|
||||
|
||||
// Index returns the index where the item equal,it will return -1 if mismatched
|
||||
func Index(slice []string, item string) int {
|
||||
for i := range slice {
|
||||
if slice[i] == item {
|
||||
|
||||
Reference in New Issue
Block a user