A collection of useful Kotlin Extension

Overview

KrazyKotlin is a collection of useful Kotlin Extension - inspired by SwifterSwift.

More extensions are on the way. If you have any requests, create an issue or submit a PR

Download

Download via Gradle:

compile 'com.vanshgandhi:krazykotlin:1.0.0'

or Maven:

<dependency>
  <groupId>com.vanshgandhi</groupId>
  <artifactId>krazykotlin</artifactId>
  <version>1.0.0</version>
  <type>pom</type>
</dependency>

Contributing

There is a list of outstanding work that needs to be done in TODO.md. All contributions are welcome

List of Extensions

  • String
    • base64Decoded
    • base64Encoded
    • camelCased
    • containsLetters
    • containsNumbers
    • isAlphanumeric
    • isAlphabetic
    • isNumeric
    • isEmail
    • isUrl
    • mostCommonCharacter
  • Date
    • calendar
    • isInFuture
    • isInPast
    • isToday
    • isTomorrow
    • isWeekend
    • isWeekday
    • iso8601
    • roundToMinute
    • roundToFiveMinutes
    • roundToTenMinutes
    • roundToFifteenMinutes
    • roundToHalfHour
    • roundToHour
    • millisecondsSince
    • secondsSince
    • minutesSince
    • hoursSince
    • daysSince
    • weeksSince
    • monthsSince
    • yearsSince
    • plus
    • minus
  • Int
    • random
  • Boolean
    • intValue

License

MIT License

Copyright (c) 2017 Vansh Gandhi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
You might also like...
A collection of hand-crafted extensions for your Kotlin projects.

Splitties Splitties is a collection of small Kotlin multiplatform libraries (with Android as first target). These libraries are intended to reduce the

A curated collection of splendid gradients made in Kotlin
A curated collection of splendid gradients made in Kotlin

Gradients A curated collection of splendid gradients made in Kotlin (port of https://webgradients.com for Android). Only linear gradients included for

KaMP Kit by Touchlab is a collection of code and tools designed to get your mobile team started quickly with Kotlin Multiplatform.
KaMP Kit by Touchlab is a collection of code and tools designed to get your mobile team started quickly with Kotlin Multiplatform.

KaMP Kit Welcome to the KaMP Kit! About Goal The goal of the KaMP Kit is to facilitate your evaluation of Kotlin Multiplatform (aka KMP). It is a coll

An awesome collaborative collection of Kotlin Multiplatform libraries

Awesome Kotlin Multiplatform Awesome Projects Updated 33 November 21, 2021 Contents Guides Dependency Injection Database NoSQL SQL Extension Reactive

Gits-android-extensions - A collection of Kotlin extensions to simplify Android development

gits-android-extensions A collection of Kotlin extensions to simplify Android de

Write a Ghidra Extension without using Java or Eclipse!

Ghidra Extension in Kotlin using IntelliJ IDEA Write a Ghidra Extension without using Java or Eclipse! Setup Hit Use this template at the top of the r

A Burp extension to find stuff ¯\_(ツ)_/¯
A Burp extension to find stuff ¯\_(ツ)_/¯

FindStuffer FindStuffer, a Burp extension to find stuff, both for Community and Pro versions. You can use FindStuffer to aggregate as many text querie

Jackson extension for Mojang's NBT format

Jackson NBT Data Format Implements Mojang's NBT format in jackson. Usage Using this format works just like regular jackson, but with the ObjectMapper

A collection of small utility functions to make it easier to deal with some otherwise nullable APIs on Android.

requireKTX requireKTX is a collection of small utility functions to make it easier to deal with some otherwise nullable APIs on Android, using the sam

Comments
  • Suggest update in lcm

    Suggest update in lcm

    In Int extensions, the lcm is implemented as

    fun Int.lcm(n: Int): Int {
        return (this * n).abs / gcd(n)
    }
    

    I would suggest a slight change as follows

    fun Int.lcm(n: Int): Int {
        return (this / gcd(n) * n).abs
    }
    

    this could prevent possible overflow and the division is guaranteed to give a whole number by the definition of the GCD.

    opened by AmrSaber 1
  • What does this do?

    What does this do?

    The extension in date to return a calendar object looks quite complicated.

    var Date.calendar: Calendar
        get() = Calendar.getInstance().apply { time = this@calendar }
        set(value) {
            time = value.timeInMillis
        }
    

    Isn't that the equivalent of this?

    val Date.calendar: Calendar
        get() = Calendar.getInstance().apply { timeInMillis = [email protected] }
    
    opened by barrywe7 1
Owner
Vansh Gandhi
SWE @twilio | GT '22 | UCLA '18
Vansh Gandhi
A library provides some useful kotlin extension functions

ktext ?? A library provides some useful kotlin extension functions. Including in your project Gradle Add below codes to your root build.gradle file (n

热心市民苏苏仔 76 Oct 26, 2022
Andorid app which provides a bunch of useful Linux commands.

Linux Command Library for Android The app currently has 3203 manual pages, 1351 one-line scripts and a bunch of general terminal tips. It works 100% o

Simon Schubert 276 Dec 31, 2022
WolfxPaper - A Paper fork designed for Wolfx Survial, may useful for some Semi-Vanilla Server

WolfxPaper A Paper fork designed for Wolfx Survial, may useful for some "Semi-Va

TenkyuChimata 1 Jan 19, 2022
A library with many useful and easy-to-use features

This library was made as a replacement for qLib and in the future cubed. These 2 plugins are hard to get you hands on and one of them has many outdated methods so this is a more modern version of those things

Max 1 May 6, 2022
An extension of EditText with pin style written in Kotlin

pin-edittext An extension of EditText with pin style Usage Include PinCodeEditText in your layout XML <com.oakkub.android.PinEditText android:layo

Metas Kerdwat 15 May 28, 2021
A set of extension properties on Int, Long, Double, and Duration, that makes it easier to work with Kotlin Duration

Kotlin Duration Extensions Gradle Groovy repositories { mavenCentral() } implementation 'com.eygraber:kotlin-duration-extensions:1.0.1' Kotlin rep

Eliezer Graber 8 Nov 8, 2022
Most used extension methods for Kotlin

Extensify Most used extension methods for Kotlin Download Step 1. Add the JitPack repository to your build file allprojects { repositories {

Mobven 36 Aug 25, 2022
A kotlin library of extension functions that add smalltalk style methods to objects.

KtTalk A kotlin library of extension functions that add smalltalk style methods to objects. Motivation Smalltalk is a pure OO language in which everyt

null 11 Oct 16, 2021
Extension functions over Android's callback-based APIs which allows writing them in a sequential way within coroutines or observe multiple callbacks through kotlin flow.

callback-ktx A lightweight Android library that wraps Android's callback-based APIs into suspending extension functions which allow writing them in a

Sagar Viradiya 171 Oct 31, 2022
An Easy-to-use Kotlin based Customizable Modules Collection with Material Layouts by BlackBeared.

Fusion By BlackBeared An Easy-to-use Kotlin based Customizable Library with Material Layouts by @blackbeared. Features Custom Floating Action Buttons

Sandip Savaliya 38 Oct 5, 2022