/**
* convert string from param to decimal type
* @param val
* @return Decimal
*/
def getStrToBigDecimal(String val) {
String stringNumber = val.toString()
stringNumber = stringNumber.replaceAll("[,]|[(]|[)]|[\$]", '')
Float number = 0
if (stringNumber.isNumber()) {
number = Float.parseFloat(stringNumber)
if (val.toString()?.endsWith(")")) {
number = -number
}
}
return number
}
วันจันทร์ที่ 11 เมษายน พ.ศ. 2554
วันจันทร์ที่ 4 เมษายน พ.ศ. 2554
Grails & Groovy Get Message Properties File
Scenario : i' am get format date from groovy (java) properties file
is very easy :
#---method to call
message(code:"code in properties file")
#---message set in the properties file
default.date.short.display.format=dd/MM/yyyy
example:
/*----println()-----
println(message(code:"default.date.short.display.format"))
#----Result println event
dd/MM/yyyy
is very easy :
#---method to call
message(code:"code in properties file")
#---message set in the properties file
default.date.short.display.format=dd/MM/yyyy
example:
/*----println()-----
println(message(code:"default.date.short.display.format"))
#----Result println event
dd/MM/yyyy
สมัครสมาชิก:
ความคิดเห็น (Atom)