utils

package
v1.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllSame

func AllSame(input string) bool

AllSame 檢查字串是否由相同字元組成

func FileExist

func FileExist(path string) bool

FileExist 檔案是否存在

func FileName

func FileName(path string) string

FileName 取得檔案名稱

func FirstLower

func FirstLower(input string) string

FirstLower 字串首字母小寫

func FirstUpper

func FirstUpper(input string) string

FirstUpper 字串首字母大寫

func GetItem

func GetItem(lists []string, index int) string

GetItem 從列表中取得項目; 如果列表數量比索引值還小, 就傳回空字串

func JsonMarshal

func JsonMarshal(value any) (result []byte, err error)

JsonMarshal 把物件轉換為json字串

func JsonToProto

func JsonToProto(filename, message string, importPaths []string, json []byte) (result []byte, err error)

JsonToProto json轉為proto資料

func NameCheck

func NameCheck(input string) bool

NameCheck 名稱檢查

func NameKeywords

func NameKeywords(input string) bool

NameKeywords 關鍵字檢查

func ProtoToJson

func ProtoToJson(filename, message string, importPaths []string, data []byte) (result []byte, err error)

ProtoToJson proto轉為json資料

func ShellRun

func ShellRun(name string, args ...string) error

ShellRun 執行shell命令

func StrToBool

func StrToBool(input string) (result bool, err error)

StrToBool 字串轉布林值

func StrToBoolArray

func StrToBoolArray(input string) (result []bool, err error)

StrToBoolArray 字串轉布林值陣列

func StrToFloat

func StrToFloat(input string) (result float64, err error)

StrToFloat 字串轉浮點數

func StrToFloatArray

func StrToFloatArray(input string) (result []float64, err error)

StrToFloatArray 字串轉浮點數陣列

func StrToInt

func StrToInt(input string) (result int64, err error)

StrToInt 字串轉整數

func StrToIntArray

func StrToIntArray(input string) (result []int64, err error)

StrToIntArray 字串轉整數陣列

func StrToStrArray

func StrToStrArray(input string) []string

StrToStrArray 字串轉為字串陣列

func TagMatch

func TagMatch(lhs, rhs string) bool

TagMatch 標籤符合

func WriteFile

func WriteFile(path string, datas []byte) error

WriteFile 寫入檔案, 如果有需要會建立目錄

func WriteTmpl

func WriteTmpl(path, content string, refer any) error

WriteTmpl 寫入模板檔案, 如果有需要會建立目錄

Types

type Duplicate

type Duplicate struct {
	// contains filtered or unexported fields
}

Duplicate 重複檢查器

func NewDuplicate

func NewDuplicate() *Duplicate

NewDuplicate 建立重複檢查器

func (*Duplicate) Check

func (this *Duplicate) Check(value ...string) bool

Check 重複檢查

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL