It's slightly faster to reject params in one line than on many.
This commit is contained in:
@@ -38,9 +38,7 @@ object Hex {
|
|||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun isHex(hex: String?): Boolean {
|
fun isHex(hex: String?): Boolean {
|
||||||
if (hex == null) return false
|
if (hex.isNullOrEmpty() || hex.length and 1 != 0) return false
|
||||||
if (hex.isEmpty()) return false
|
|
||||||
if (hex.length and 1 != 0) return false // must be even
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for (c in hex.indices) {
|
for (c in hex.indices) {
|
||||||
|
|||||||
Reference in New Issue
Block a user