on 08-13-2007 6:16 PM
Hi Experts,
Can u suggest me how to write the UDF Function From STRING TO FLOAT.
Thanks & Regards,
Sateesh
Would it make more sense to use the Float class?
float return=Float.parseFloat(input);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Avoid using float in Java, as it leads to round errors.
Use BigDecimal instead.
http://java.sun.com/j2se/1.4.2/docs/api/java/math/BigDecimal.html
BigDecimal big = new BigDecimal("your_string");
Regards,
Henrique.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
its working
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Sateesh,
It will convert to float
float return=Double.parseDouble(input);
or
float return=Double.valueOf(input).floatValue();
best,
Wojciech
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.