Created
June 16, 2019 12:21
-
-
Save automationhacks/5180077b86ca19d61b0bc68550608e42 to your computer and use it in GitHub Desktop.
Initial Example of show use of functions and available features
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
package _03_functions | |
class StringUtils { | |
fun getFirstWord(word: String, separator: String): String { | |
return word.split(separator)[0] | |
} | |
fun getFirstWord(word: String) = getFirstWord(word, " ") | |
} | |
fun main(args: Array<String>) { | |
val first = StringUtils().getFirstWord("Jane Doe") | |
println("First word: $first") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment