//判断string 是否是数值
def isNotIntType(str: String): Boolean = {
val pattern = "^(\d+)$".r
str match {
case pattern(_*) => false
case _ => true
}
}
//判断string是否是时间 yyyyMMdd HH:mm:ss
def isNotTimeType(str: String): Boolean = {
val pattern = "^[1-9]\d{3}(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])\s+(20|21|22|23|[0-1]\d):[0-5]\d:[0-5]\d$".r
str match {
case pattern(_*) => false
case _ => true
}
}
def stringNulltoEmpty(xx: String): String = if (xx != null) xx else ""
/**
* map转json
* @param map Map
* @return String
*/
def getJsonStr(map: Map[String,String]): String = {
val str = write(map)
str
}