Commit 679e26bb authored by 雪煾's avatar 雪煾
Browse files

refactor: refactor overloads with kotlin types

parent 7c0c1230
......@@ -104,19 +104,11 @@ data class ApplicationInterface(private val url: String, private val email: Stri
return getChinFongList().isNotEmpty()
}
fun getChinFongList(): List<String> {
return getChinFongList(getAnswer())
}
fun getChinFongList(text: String): List<String> {
fun getChinFongList(text: String = getAnswer()): List<String> {
return Regex("(?<=\\[data\\]\\()(.*?)(?=\\))").findAll(text).toList().flatMap(MatchResult::groupValues)
}
fun replceWithChinFong(json: JSONObject): String {
return replceWithChinFong(json, getAnswer())
}
fun replceWithChinFong(json: JSONObject, text: String): String {
fun replceWithChinFong(json: JSONObject, text: String = getAnswer()): String {
var tempText = text
for (t in getChinFongList(text)) {
tempText = tempText.replace("[data]($t)", json.getString(t))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment