1 package textmagic 2 3 var maxInSlice = 100 4 5 func splitSlice(slice []string) [][]string { 6 toRet := make([][]string, 0, len(slice)/maxInSlice+1) 7 for len(slice) > maxInSlice { 8 toRet = append(toRet, slice[:maxInSlice]) 9 slice = slice[maxInSlice:] 10 } 11 if len(slice) > 0 { 12 toRet = append(toRet, slice) 13 } 14 return toRet 15 } 16 17 func utos(num uint64) string { 18 if num == 0 { 19 return "0" 20 } 21 var digits [21]byte 22 pos := 21 23 for ; num > 0; num /= 10 { 24 pos-- 25 digits[pos] = '0' + byte(num%10) 26 } 27 return string(digits[pos:]) 28 } 29