bug fix [1636180] AmtInWords_ES

This commit is contained in:
afalcone 2007-01-30 21:15:52 +00:00
parent 0e9b4e1df0
commit 08a767ae54
1 changed files with 11 additions and 5 deletions

View File

@ -39,7 +39,7 @@ public class AmtInWords_ES implements AmtInWords
" BILLON", " BILLON",
" TRILLON", " TRILLON",
" CUATRILLON", " CUATRILLON",
" QUINTRILLON" " QUINTILLON"
}; };
private static final String[] tensNames = { private static final String[] tensNames = {
@ -177,13 +177,19 @@ public class AmtInWords_ES implements AmtInWords
return amount; return amount;
// //
StringBuffer sb = new StringBuffer (); StringBuffer sb = new StringBuffer ();
int pos = amount.lastIndexOf ('.'); // int pos = amount.lastIndexOf ('.'); // Old
int pos2 = amount.lastIndexOf (','); int pos = amount.lastIndexOf (',');
// int pos2 = amount.lastIndexOf (','); // Old
int pos2 = amount.lastIndexOf ('.');
if (pos2 > pos) if (pos2 > pos)
pos = pos2; pos = pos2;
String oldamt = amount; String oldamt = amount;
amount = amount.replaceAll (",", "");
int newpos = amount.lastIndexOf ('.'); // amount = amount.replaceAll (",", ""); // Old
amount = amount.replaceAll( "\\.","");
// int newpos = amount.lastIndexOf ('.'); // Old
int newpos = amount.lastIndexOf (',');
int pesos = Integer.parseInt (amount.substring (0, newpos)); int pesos = Integer.parseInt (amount.substring (0, newpos));
sb.append (convert (pesos)); sb.append (convert (pesos));
for (int i = 0; i < oldamt.length (); i++) for (int i = 0; i < oldamt.length (); i++)