A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
Welcome to the Remove All Whitespace in Kotlin page! Here, you'll find the source code for this program as well as a description of how the program works.
import kotlin.system.exitProcess
fun main(args: Array<String>) {
val phrase: String = errorChecking(args)
println(removeWhitespace(phrase))
}
fun usageError() {
println("Usage: please provide a string")
}
fun errorChecking(args: Array<String>): String {
if (args.size == 0 || args[0] == "") {
usageError()
exitProcess(1)
}
return args[0]
}
fun removeWhitespace(phrase: String): String {
return phrase.filter { !it.isWhitespace() }
}
Remove All Whitespace in Kotlin was written by:
If you see anything you'd like to change or update, please consider contributing.
No 'How to Implement the Solution' section available. Please consider contributing.
No 'How to Run the Solution' section available. Please consider contributing.