Skip to content

lucas-barbosa/unitconverter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UnitConverter

It's a Go package to convert units of measure.

Getting Started

These instructions will make you have a copy of this package on your machine and import into your program.

Installing

Use this command in your Command Line Tool:

go get -u "github.com/lucabarbosa/unitconverter"

This will make a copy of the package in your Go workspace.

Usage

Add the following line to your Go file.

import "github.com/lucabarbosa/unitconverter"

Units of Measure

This package covers the following units os measure:

  • Length
    • Inches
    • Feets
    • Meters
  • Temperature
    • Celsius
    • Fahrenheit
    • Kelvin
  • Weight
    • Kilograms
    • Pounds
    • Stones

This package allows you to convert each of the measurement units to each other (provided they are in the same category).

Demonstration

Length

This will convert a Meter Length to Feets:

meterLength := unitconverter.Meter(21)
feetLength := unitconverter.MeterToFeet(meterLength)

// output: 68.89763779527559'

Temperature

This will convert a Celsius Temperature to Kelvin:

celsiusTemperature := unitconverter.Celsius(35)
kelvinTemperature := unitconverter.CelsiusToKelvin(celsiusTemperature)

// output: 308°K

Weight

This will convert a Kilogram Wight to Pound:

kilogramWeight := unitconverter.Kilogram(75)
poundWeight := unitconverter.KilogramToPound(kilogramWeight)

// output: 165 lbs

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Releases

No releases published

Packages

No packages published

Languages