Skip to content

chattymin/Pebble

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

34 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Pebble GitHub License MIN SDK

Treat String Like A Pebble With Grapheme At Kotlin ๐Ÿซง
The Easy Way To Use Emoji ๐Ÿš€

Why Pebble?

In Android, String is encoded in UTF-8, which means characters like emojis may not count as a single character.

"๐Ÿš€".length == 2
"๐Ÿง‘โ€๐Ÿง‘โ€๐Ÿง’โ€๐Ÿง’".length == 11

Many applications display the character count when users enter text, such as nicknames or posts.
However, due to certain issues, emojis are not counted correctly.

AS-IS TO-BE
image image

To address this inconvenience, Pebble Is Coming!

Gradle Settings

Add the codes below to your root build.gradle file (not your module-level build.gradle file):

allprojects {
    repositories {
        mavenCentral()
    }
}

And, Add the dependency below to your module build.gradle file:

dependencies {
    implementation("io.github.chattymin:pebble:0.1.0")
}


How To Use?

"๐Ÿš€".graphemeLength == 1
"๐Ÿš€".isEmoji() == true
"Hello Pebble ๐Ÿš€ Welcome!".containsEmoji() == true
"Hello๐Ÿš€ This is Pebble!๐Ÿซง Welc๐Ÿง‘โ€๐Ÿง‘โ€๐Ÿง’โ€๐Ÿง’ome :)".extractEmojis() == ["๐Ÿš€", "๐Ÿซง", "๐Ÿง‘โ€๐Ÿง‘โ€๐Ÿง’โ€๐Ÿง’"]
"Hello๐Ÿš€ This is Pebble!๐Ÿซง Welc๐Ÿง‘โ€๐Ÿง‘โ€๐Ÿง’โ€๐Ÿง’ome :)".filterEmojis() == "Hello This is Pebble! Welcome :)"

In addition to this, various types of extension functions are also available.
The goal is to cover all ranges officially provided by Kotlin.

You can explore and use various extension functions within the Pebble module :)

Want To Contriubte

Contributions are always welcome!
Feel free to make an issue everything that you want to contribute!
Welcome New Extensions, Performance Improvements, and all ways of working with stringsโ€”just like Pebble!

CONTRIBUTING.md

Contributors

contributors

License

Copyright 2025 chattymin (Dongmin Park)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

Treat String Like A Pebble With Grapheme At Kotlin ๐Ÿซง The Easy Way To Use Emoji ๐Ÿš€

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

โšก