Non-decimal radices/Convert: Difference between revisions
Content added Content deleted
m (→Python: number to string: Enabled syntax highlighting) |
(Updated to work with Nim 1.4: replaced ".. <" with "..<", replaced "toLower" with "toLowerAscii".) |
||
Line 2,202: | Line 2,202: | ||
for i in first .. str.high: |
for i in first .. str.high: |
||
let c = str[i]. |
let c = str[i].toLowerAscii |
||
assert c in digits[0 .. |
assert c in digits[0 ..< base] |
||
result = result * base + digits.find c |
result = result * base + digits.find c |
||