toSystem static method
toSystem converts a positive int
to the LayrzNumber
system.
Implementation
static String toSystem(int value) {
assert(value >= 0, 'The value must be greater than or equal to 0.');
int baseSystem = equivalences.length;
String result = '';
while (true) {
int q = value ~/ baseSystem;
int r = value % baseSystem;
result = '${equivalences[r]}$result';
value = q;
if (q == 0) break;
}
return result;
}