number_system 0.0.6+8 copy "number_system: ^0.0.6+8" to clipboard
number_system: ^0.0.6+8 copied to clipboard

A package to extend the functionality to convert between number systems

number_system #

A package to extend the functionality to convert between number systems

Hecho en 🇵🇷 por Radamés J. Valentín Reyes

Importing library #

import 'package:number_system/number_system.dart';

Note #

Rather than the functionality being provided as normal functions it is provided as Extensions so that functions are available through dot notation on valid types.

Examples #

Hexadecimal to decimal #

Returns the integer value of a hexadecimal String. Extension for String type.

String testString = "#f32";
print("$testString = ${testString.hexToDEC()}");

Decimal to hexadecimal #

Returns a String representing the integer in hexadecimal. Extension for int type.

int testInteger = 1667;
print("$testInteger in hex is ${testInteger.decToHex()}");

Desired digits test on decimal to hexadecimal

Decimal to hexadecimal example containing the optional parameter called desired digits. If the resulting hexadecimal value is smaller than the desired digits value 0s will be added to the left side of the number to return a number with the desired length. Extension for int type.

int testInteger = 1667;
print("$testInteger in hex is ${testInteger.decToHex(4)}");

Decimal to octal #

Calculates and returns the octal value of this integer

int testInteger = 1667;
print("$testInteger in octal is ${testInteger.decToOctal()}");

Octal to decimal #

Calculate and return the decimal value of this octal integer

int testInteger = 3203;
print("$testInteger in decimal is ${testInteger.octalToDec()}");

Binary to decimal #

Calculate and return the decimal value of this binary number(string)

String bin = "10";
print(bin.binaryToDec());

Decimal(integer) to binary #

Calculate and return the binary value of this integer

int dec = 5;
print(dec.decToBinary());

Contribute/donate by tapping on the Pay Pal logo/image #


References #

1
likes
120
pub points
72%
popularity

Publisher

unverified uploader

A package to extend the functionality to convert between number systems

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

More

Packages that depend on number_system