Skip to content

Latest commit

 

History

History
86 lines (68 loc) · 2.71 KB

README.md

File metadata and controls

86 lines (68 loc) · 2.71 KB

pangu.kt

badge-version badge-jvm badge-js badge-nodejs badge-android badge-ios badge-watchos badge-tvos badge-macos badge-windows badge-linux

Kotlin Multiplatform (Kotlin MPP aka KMP) implementation of pangu.js.

Usage

If your project is a Kotlin multiplatform project, add the dependency in build.gradle.kts:

kotlin {
    sourceSets {
        val commonMain by getting {
            dependencies {
                implementation("io.github.darkokoa:pangu:<version>")
            }
        }
    }
}

If your project is a(an) JVM or Android project:

dependencies {
    implementation("io.github.darkokoa:pangu-jvm:<version>")
}

Example

In Kotlin

// use Pangu singleton
val pendingText = "..."
val completedText = Pangu.spacingText(pendingText)

// use kotlin extension function
val pendingText = "..."
val completedText = pendingText.spacingText(pendingText)

In Java

// use Pangu singleton
String pendingText = "...";
String completedText = Pangu.INSTANCE.spacingText(pendingText);

// use PanguKt static class
String pendingText = "...";
String completedText = PanguKt.spacingText(pendingText);

Matters Needing Attention

  1. The processing time also becomes longer when you need to process longer text. Doing so will block the current thread for a long time. If the UI thread is blocked it means that the program may crash.
  2. Java support requires Java 8 or above.

License

Released under the MIT License.