allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.MaaxGr:KotlinUtils:1.2.0'
}
- Execute a bash command
- Possibility to handle each output line
- Possibility to handle complete output result.
- No Deadlock => executeCommand() can handle huge output
val result = BashUtil.executeCommand("echo 'Hello World'") { line ->
// handle read line. e.g. print it out
println(line)
}
// result is the complete output string
println(result)
findFirst(input: String)
find first match for input on regexfindAll(input: String)
find all matches for input on regex
val regex = MRegex("http:\\/\\/([a-z0-9-\\.]+):(\\d+)")
val analze = regex.findFirst("https://my.test.com:3128")
if (analze is FindFirstResult.SingleMatch) {
val (hostname: String, port: String) = analze.groups
println("Host: $hostname; Port $port")
}
camelToSnakeCase()
snakeToUpperCamelCase()
snakeToLowerCamelCase()