AlgoSim
Homepage | Screenshots | Gallery of Visualisation | User's Guide | Function Reference | Download | FAQ | Support | Bugs and Solutions | Donate

Reference: baseNInput

baseNInput(s, N) returns the integer represented by the string s in base-N, where s is a string of the N − 1 base-N digits 0, 1, 2, ..., 8, 9, A, B, ...(, Y, Z).

For example, baseNInput("567", 10), baseNInput("FF", 16), baseNInput("1000", 2), baseNInput("43HA2", 20), and baseNInput("43HA2", 16) will return 567, 255, 8, 671002, and the error message "The base-N digit H is not used in base 16", respectively.

By default, the infix operator # is mapped to the baseNInput function. Its first operand is a raw string, and the second operand is an integer. Hence
567#10, FF#16, 1000#2, 43HA2#20, and 43HA2#16 will return the same results as those obtained above.