I am working on a report and I am having a little issue with the output.
I have several dollar amount fields that I need to format with only the decimal place. The amount fields are coming in as strings between 10-16 characters.
I could not find a way to use the currency formatter so I used substrings to break it apart and put it back together in the format I need. However I am now running into an issue with leading zeros. I can't used ReplaceAll as there is a possibility of having a 0 in the amount field.
Here is what I have done for the substrings:
int intLength = strField.length();
intDollar = intLength - 2;
strDollar = strField.substring(1, intDollar);
strCent = strField.substring(intDollar, intLength);
System.out.println(strDollar + "." + strCent);
The original string: 0000000037049469
My output now: 00000000370494.69
Desired output: 37049469
Any suggestions on how to remove the leading zeros?
Edited by: xxwhocaresxx on Jun 10, 2009 12:11 PM