Kotlin: using extensions

Example:

fun String.hasSpaces(): Boolean { return this.contains(" ") }
Kotlin allows you to add new functions to existing types without modifying them.

Solution:

val hasSpaces = "Hello World".hasSpaces()

Beginner's Guide to Kotlin