parent
2a931937a8
commit
a2f13eae55
10 changed files with 79 additions and 46 deletions
|
@ -464,6 +464,15 @@ func EllipsisString(str string, length int) string {
|
|||
return str[:length-3] + "..."
|
||||
}
|
||||
|
||||
// TruncateString returns a truncated string with given limit,
|
||||
// it returns input string if length is not reached limit.
|
||||
func TruncateString(str string, limit int) string {
|
||||
if len(str) < limit {
|
||||
return str
|
||||
}
|
||||
return str[:limit]
|
||||
}
|
||||
|
||||
// StringsToInt64s converts a slice of string to a slice of int64.
|
||||
func StringsToInt64s(strs []string) []int64 {
|
||||
ints := make([]int64, len(strs))
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue