on ‎2007 Aug 13 6:16 PM
Hi Experts,
Can u suggest me how to write the UDF Function From STRING TO FLOAT.
Thanks & Regards,
Sateesh
Help others by sharing your knowledge.
AnswerRequest clarification before answering.
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 |
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.