AnyBase class

Convert numbers from any base (radix) to any other base using any alphabet of digits.

Example

const dec2hex = AnyBase(AnyBase.dec, AnyBase.hex);

dec2hex.convert('123456'); // returns '1e240'.
dec2hex.revert('1e240');   // returns '123456'.

Returns an AnyBase object that can be used to convert input from the source alphabet to the destination alphabet, extrapolating the radices from the lengths of the alphabets.

Constructors

AnyBase(String sourceAlphabet, String destinationAlphabet)
const

Properties

destinationAlphabet String
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sourceAlphabet String
final

Methods

convert(String source) String
Convert source from the source alphabet to the destination alphabet.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
revert(String source) String
Convert source from the destination alphabet to the source alphabet.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

bin → const String
Predefined alphabet for binary.
dec → const String
Predefined alphabet for decimal.
hex → const String
Predefined alphabet for hexadecimal.
oct → const String
Predefined alphabet for octal.