Skip to content

Library untuk mengkonversi format Double ke jam menit detik & derajat menit detik/sebaliknya

License

Notifications You must be signed in to change notification settings

hasanelfalakiy/lib-konversi

Repository files navigation

app_banner

Konversi

latest_release jitpack_release build_with_kotlin License

Tentang Library Konversi

Library untuk mengkonversi format DMS ke Desimal (Double) & format Desimal (Double) ke derajat menit detik (DMS) /jam menit detik (HMS), untuk keperluan komputasi terutama perhitungan Astronomi/Falak.

Fitur

  • mengubah format DMS/HMS ke Double
  • mengubah format Double ke j m d
  • mengubah format Double ke DMS, ada beberapa varian
  • mengubah format Double ke HMS, ada beberapa varian
  • Extension function Double.round(), untuk mengcustom pembulatan dibelakang koma

Konfigurasi pertama

  1. masukkan kode ini ke settings.gradle.kts (root kotlin dsl) di blok repositories
  dependencyResolutionManagement {
    repositories {
      // contoh
      maven {
        url = uri("https://jitpack.io")
      }
    }
  }

jika menggunakan groovy dsl

  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
  1. masukkan dependensi ke build.gradle.kts (app/build.gradle.kts kotlin dsl) di blok dependencies
implementation("com.github.hasanelfalakiy:lib-konversi:4.0.1")

jika menggunakan groovy dsl

implementation 'com.github.hasanelfalakiy:lib-konversi:4.0.1'

Tutorial Youtube

Praktik implementasi library hisab irsyadul murid

Daftar fungsi

/* 
* fungsi mengubah DMS ke Double, jika bernilai negatif,
* wajib memasukkan tanda negatif (-) disetiap input DMS.
* parameter second bisa menerima integer/double
*/
fun toDecimal(degree: Int, minute: Int, second: Number): Double

/*
* fungsi ini mengubah DMS ke Double dengan input data nilai positif semua,
* sedangkan untuk positif/negatif nya tambahkan parameter true untuk positif
* false untuk negatif
*
* tipe Number berarti menerima tipe Integer/Double
*/
fun toDecimalCheck(degree: Int, minute: Int, second: Number, check: Boolean): Double

/*
* HH:MM detik dibulatkan ke menit, menit ke jam jika menit == 60,
* positif/negatif : sama-sama dibulatkan keatas/kebawah (menjauhi nol)
*/
fun toTime(decimal: Double): String

// HH:MM:SS angka dibelakang koma orde detik tidak dibulatkan ke detik integer
fun toTimeFull(decimal: Double): String

// HH:MM:SS angka dibulatkan ke detik
fun toTimeFullRound(decimal: Double): String

// HH:MM:SS,ss dibulatkan ke 2 angka di belakang koma 
fun toTimeFullRound2(decimal: Double): String

// DD° MM' SS" angka dibelakang koma orde detik tidak dibulatkan ke detik integer
fun toDegreeFull(decimal: Double): String

// DD° MM' SS" angka dibulatkan ke detik
fun toDegreeFullRound(decimal: Double): String

// DD° MM' SS,ss" dibulatkan ke 2 angka di belakang koma
fun toDegreeFullRound2(decimal: Double): String

// HH j MM m SS,ss d dibulatkan ke 2 angka di belakang koma
fun toCounterTimeRound2(decimal: Double): String

// Extension Function Round, custom round membulatkan angka di belakang koma
fun Double.round( decimals : Int ) : Double

Ingin berkontribusi?

Jika Anda ingin berkontribusi, silahkan menggarpu (Fork) repositori ini, buat perubahan, kirim Pull request ke repositori ini

Kontak Kami

License

Library Konversi
Copyright (C) 2023-2024  Andi Hasan Ashari

Library Konversi is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Library Konversi is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Library Konversi.  If not, see <https://www.gnu.org/licenses/>.

Report to us if anyone violates the terms of the License, either by creating issues or writing to us directly.

About

Library untuk mengkonversi format Double ke jam menit detik & derajat menit detik/sebaliknya

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages