MCPcopy Create free account
hub / github.com/boombuler/barcode / shouldUseCTable

Function shouldUseCTable

code128/encode.go:23–44  ·  view source on GitHub ↗
(nextRunes []rune, curEncoding byte)

Source from the content-addressed store, hash-verified

21}
22
23func shouldUseCTable(nextRunes []rune, curEncoding byte) bool {
24 requiredDigits := 4
25 if curEncoding == startCSymbol {
26 requiredDigits = 2
27 }
28 if len(nextRunes) < requiredDigits {
29 return false
30 }
31 for i := 0; i < requiredDigits; i++ {
32 if i%2 == 0 && nextRunes[i] == FNC1 {
33 requiredDigits++
34 if len(nextRunes) < requiredDigits {
35 return false
36 }
37 continue
38 }
39 if nextRunes[i] < '0' || nextRunes[i] > '9' {
40 return false
41 }
42 }
43 return true
44}
45
46func tableContainsRune(table string, r rune) bool {
47 return strings.ContainsRune(table, r) || r == FNC1 || r == FNC2 || r == FNC3 || r == FNC4

Callers 2

Test_shouldUseCTableFunction · 0.85
getCodeIndexListFunction · 0.85

Calls

no outgoing calls

Tested by 1

Test_shouldUseCTableFunction · 0.68