Skip to content

Instantly share code, notes, and snippets.

@yiheng0

yiheng0/utils.kt Secret

Created Jan 22, 2021
Embed
What would you like to do?
package moe.yiheng
import java.text.SimpleDateFormat
import java.util.*
import java.util.regex.Pattern
fun getDate(): String {
val simpleDateFormat = SimpleDateFormat("yyyy/MM/dd")
return simpleDateFormat.format(Date())
}
fun Any.println() {
println(this.toString())
}
fun findString(form: String,regex:String): String? {
val pattern = Pattern.compile(regex)
val matcher = pattern.matcher(form)
var result: String? = null
while (matcher.find()) {
result = matcher.group(1)
}
return result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment