Simple unit conversion library for Kotlin

Related tags

App ktunits
Overview

Build Status Download

KtUnits

Simple unit conversion library for Kotlin.

Usage

Conversion

You can convert units easily:

fun foo() {
  val m = 100.minutes.toMilliseconds // magic
  println("100 minutes equal $m milliseconds")
}

Parameters

You can take a value as an argument without worrying about the units, and convert to the units you want when you use it.

fun wait(time: TimeValue) {
  Thread.sleep(time.toMilliseconds)
}

fun bar() {
  wait(5.seconds)
  wait(10.days)
}

Supported units

The library currently supports time (from nanoseconds to days) and memory (from bits to pebibytes).

Download

Just put this in your build.gradle or Build.kt. Replace <version> with the version shown in the badge at the top of this README.md.

dependencies {
  compile("me.sargunvohra.lib:ktunits:1.1.2")
}
You might also like...
A simple and stright-forward library for displaying mathematical equations or formulas in your android application

MathRenderer Simple and easy library written in kotlin language for displaying mathematical equations or formulas using MathJax. MathRenderView is bac

Android-stories: A simple stories library inspired by Instagram and alike
Android-stories: A simple stories library inspired by Instagram and alike

A simple stories library inspired by Instagram and alike. Requirements Min SDK = 22 Installation Add these dependencies to your proje

A simple and easy to use stopwatch and timer library for android

TimeIt Now with Timer support! A simple and easy to use stopwatch and timer library for android Introduction A stopwatch can be a very important widge

Show worldwide headline. API/Glide library/recycler view/volley library/kotlin/xml/ chrome custom tabs
Show worldwide headline. API/Glide library/recycler view/volley library/kotlin/xml/ chrome custom tabs

Show worldwide headline. API/Glide library/recycler view/volley library/kotlin/xml/ chrome custom tabs. - you can click on headline and it will open an article of that news in the app(no need to go to chrome or any browser)

A simple android Twitter client written in Kotlin
A simple android Twitter client written in Kotlin

Blum Blum is an unofficial, simple, fast Twitter client written in Kotlin. This project is a complete rewrite of the Java version. Screenshot Build To

 Nice and simple DSL for Espresso in Kotlin
Nice and simple DSL for Espresso in Kotlin

Kakao Nice and simple DSL for Espresso in Kotlin Introduction At Agoda, we have more than 1000 automated tests to ensure our application's quality and

A Simple Calculator developed in Kotlin
A Simple Calculator developed in Kotlin

Calculator developed in Kotlin This was my first contact with mobile programming using Kotlin. The calc is basic, but it was the first project I did.

MarsRealEstate is a simple demo app using ViewModel & LiveData with Retrofit, Glide and Moshi in Kotlin.
MarsRealEstate is a simple demo app using ViewModel & LiveData with Retrofit, Glide and Moshi in Kotlin.

Android-NASA-Real-Estate-Mars Is Android app that uses Kotlin and MVVM architecture is a simple app that uses Coroutines, LiveData with Retrofit, Glid

Simple blockchain example written in Kotlin

Blockchain in Kotlin This is a plain example how Cryptographic blockchains work by constructing a blockchain containing three blocks. Once constructed

Owner
Sargun Vohra
Sargun Vohra
MVVM + Kotlin + Jetpack Compose +Navigation Compose + Hilt + Retrofit + Unit Testing + Compose Testing + Coroutines + Kotlin Flow + Io mockK

MvvmKotlinJetpackCompose Why do we need an architecture even when you can make an app without it? let's say you created a project without any architec

Sayyed Rizwan 46 Nov 29, 2022
Clean Architecture Kotlin Multiplatform Mobile (KMM) with Android Instrument Test and Unit Test

The-Movies: Clean Architecture Kotlin Multiplatform Mobile What're inside? - Jetpack Compose - Hilt - Ktor - Android Instrument Test - Unit Test - SQL

null 17 Dec 5, 2022
Android playground project with modularization by feature (android libraries), unit tests, MVVM & MVI.

Movies Movies is a simple project to study and play with some android components, architecture and tools for Android development. Tech Stack This proj

Christopher Elias 333 Dec 30, 2022
Simple-todo-app - Simple Memo App using SQLite

Judul Aplikasi Aplikasi Memo Sederhana menggunakan SQLite. Fitur Aplikasi Memo y

Ananda Muhamad Lukman 0 Jan 3, 2022
Spantastic - an Android library that provides a simple and Kotlin fluent API for creating Android Spannable

Spantastic is an Android library that provides a simple and Kotlin fluent API for creating Android Spannable. This library wrappers SpannableStringBuilder and add methods to easily decorate the text with multiple spans.

Wellington Cabral da Silva 12 Nov 27, 2022
An simple image gallery app utilizing Unsplash API to showcase modern Android development architecture (MVVM + Kotlin + Retrofit2 + Hilt + Coroutines + Kotlin Flow + mockK + Espresso + Junit)

Imagine App An simple image gallery app utilizing Unsplash API. Built with ❤︎ by Wajahat Karim and contributors Features Popular photos with paginatio

Wajahat Karim 313 Jan 4, 2023
Simple amazing Donut Progress library🚀

DonutProgress ?? Now this readme is very poooor ?? To implement As usual ?? in project build.gradle: allprojects { repositories { ... maven {

Joseph Balzano 3 May 13, 2021
Simple library to decompress files .zip, .rar, .cbz, .cbr in React Native.

Uncompress React Native Simple library to decompress files .zip, .rar, .cbz and .cbr in React Native. Installation yarn add uncompress-react-native o

Adriano Souza Costa 40 Nov 24, 2022
This library makes it easy for you to develop an simple drawing app in android

DrawingCanvas Library for drawing app canvas Features Size , transperancy and color manupulation of brush -- Using setSizeForBrush(), setBrushAlpha()

Mihir Shah 24 Nov 27, 2022
A Simple Android Library for Kenyan Counties

KenyanCounties A Simple Android Library for Kenyan Counties Step 1. Add the JitPack repository to your build file Add it in your root build.gradle at

Joel Kanyi 18 Jul 12, 2022