Архив

Posts Tagged ‘Number’

OAF: Конвертация типов

Тип Конвертирование
STRING to NUMBER
byte Byte.parseByte(«123»)
byte Byte.valueOf(«123»).byteValue()
short Short.parseShort(«123»)
short Short.valueOf(«123»).shortValue()
int Integer.parseInt(«123»)
int Integer.valueOf(“123”).intValue()
long Long.parseLong(«123»)
long Long.valueOf(«123»).longValue()
float Float.parseFloat(«123.4»)
float Float.valueOf(«123.4»).floatValue()
double Double.parseDouble(«123.4e10»)
double Double.valueOf(«123.4e10»).doubleValue()
Number new Number(Integer.parseInt(«123»))
NUMBER to STRING
String “” + 123
String Number pageContext.getOANLSServcies().NumberToString(num,»###,###,##0.00000;-###,###,##0.00000″);
String int Integer.toString(123)
String double Double.toString(123.4e10)
String long Long.toString(123)
String float Float.toString(123.4)
STRING to DATE
Date String DATE_FORMAT = «dd-mm-yyyy»;

java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(DATE_FORMAT);

Date myDate =  sdf.parse(“01-10-2010”)

Date java.sql.Date myDate = pageContext.getOANLSServcies().stringToDate(“01-10-2010”);

oracle.jbo.domain.Date date1 = new Date(myDate);