pull/37/head
kunfei 5 years ago
parent e4dc091a2c
commit b337544399
  1. 10
      app/src/main/java/io/legado/app/utils/StringExtensions.kt

@ -20,18 +20,12 @@ fun String?.isJson(): Boolean = this?.run {
fun String?.isJsonObject(): Boolean = this?.run { fun String?.isJsonObject(): Boolean = this?.run {
val str = this.trim() val str = this.trim()
when { str.startsWith("{") && str.endsWith("}")
str.startsWith("{") && str.endsWith("}") -> true
else -> false
}
} ?: false } ?: false
fun String?.isJsonArray(): Boolean = this?.run { fun String?.isJsonArray(): Boolean = this?.run {
val str = this.trim() val str = this.trim()
when { str.startsWith("[") && str.endsWith("]")
str.startsWith("[") && str.endsWith("]") -> true
else -> false
}
} ?: false } ?: false
fun String?.htmlFormat(): String = if (this.isNullOrBlank()) "" else fun String?.htmlFormat(): String = if (this.isNullOrBlank()) "" else

Loading…
Cancel
Save