Skip to content

Instantly share code, notes, and snippets.

@fanjavaid
Created August 15, 2022 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fanjavaid/520f808b16fb034a4dad938226573e3a to your computer and use it in GitHub Desktop.
Save fanjavaid/520f808b16fb034a4dad938226573e3a to your computer and use it in GitHub Desktop.
Simple thousand formatter and cleaner
fun Long.formatThousand(): String {
val decimalFormatter = DecimalFormat("#,###")
return decimalFormatter.format(this)
}
fun String.clearThousandFormat(): String {
return this.replace(",", "")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment