Last active
April 5, 2023 09:02
-
-
Save akshaykalola28/1b162d7de989339e778268f65075eb9d to your computer and use it in GitHub Desktop.
Extension remove whitespace for kotlin developer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun String.removeAllWhitespaces(): String { | |
return this.replace("\\s+".toRegex(), "") | |
} | |
fun String.removeDuplicateWhitespaces(): String { | |
return this.replace("\\s+".toRegex(), " ") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment