1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-05 10:07:22 +00:00

#1157 some avatar setting changes

- Allow to delete current avatar
This commit is contained in:
Unknwon
2016-03-05 00:51:51 -05:00
parent 2a931937a8
commit a2f13eae55
10 changed files with 79 additions and 46 deletions

View File

@ -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))