package mtp.polymer.com.autowidget.expand

import java.util.regex.Pattern

/**
 * 判断String是否是数字
 */
fun String.isNumber(): Boolean {
    val pattern: Pattern = Pattern.compile("-?[0-9]+(\\.[0-9]+)?")
    val isNum = pattern.matcher(this)
    if (!isNum.matches()) {
        return false
    }
    return true
}

