Discussion

Getting Data from clipboard

Hi, I am formatting few fields in an activity by taking and putting back the data on clipboard for another application to pick. I use java to format currency which is double type. The only way I see to get value is tools.findPage("myStepPage").getString(".myValue") which is string. The java method to format currency expects input in the form of double. What is the best way to accomplish the conversion. By the way HTML properties for conversion doesnot seem to work while putting the values on clipboard. It is good to display in the forms. Any suggestions!!!

***Updated by moderator: Marissa to close post***
This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.

Comments

Keep up to date on this post and subscribe to comments

November 7, 2008 - 7:47am

Assuming I am reading correctly you are trying to convert a string you already have retreived inside of a Java step of an activity. Sounds like you just need a conversion function, so the Java code below should take care of that. Sorry if I'm misunderstanding the problem.

[code]String aString = "99";
double aDouble = Double.parseDouble(aString);[/code]

November 10, 2008 - 4:01pm

Due to rounding issues, BigDecimal has always been recommended over float or double data types for currency. You can read about the API here: http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigDecimal.html