(value string, limit int)
| 67 | } |
| 68 | |
| 69 | func LimitStr(value string, limit int) string { |
| 70 | n := 0 |
| 71 | for i := range value { |
| 72 | if n >= limit { |
| 73 | return value[:i] |
| 74 | } |
| 75 | n++ |
| 76 | } |
| 77 | return value |
| 78 | } |
| 79 | |
| 80 | // Similar to a regular GroupBy, except that each item can be grouped under multiple keys, |
| 81 | // so the callback returns a slice of keys instead of just one key. |
no outgoing calls