(value string, maxBytes int)
| 236 | } |
| 237 | |
| 238 | func truncateUTF8Bytes(value string, maxBytes int) string { |
| 239 | if maxBytes <= 0 || value == "" { |
| 240 | return "" |
| 241 | } |
| 242 | if len(value) <= maxBytes { |
| 243 | return value |
| 244 | } |
| 245 | |
| 246 | cut := 0 |
| 247 | for idx := range value { |
| 248 | if idx > maxBytes { |
| 249 | break |
| 250 | } |
| 251 | cut = idx |
| 252 | } |
| 253 | return value[:cut] |
| 254 | } |
no outgoing calls
no test coverage detected