blob: b1a5d3131fb93fcd60055c8651063560b6a4ae28 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
package utils
// formatMessageCount returns the formatted number of
// messages containing a thousands comma
func FormatMessageCount(messageCount string) string {
if len(messageCount) == 9 {
return messageCount[:3] + "," + messageCount[3:6] + "," + messageCount[6:]
} else if len(messageCount) == 8 {
return messageCount[:2] + "," + messageCount[2:5] + "," + messageCount[5:]
} else if len(messageCount) == 7 {
return messageCount[:1] + "," + messageCount[1:4] + "," + messageCount[4:]
} else if len(messageCount) == 6 {
return messageCount[:3] + "," + messageCount[3:]
} else if len(messageCount) == 5 {
return messageCount[:2] + "," + messageCount[2:]
} else if len(messageCount) == 4 {
return messageCount[:1] + "," + messageCount[1:]
} else {
return messageCount
}
}
|