18 package org.turro.financials.model;
30 StringBuilder text =
new StringBuilder(a);
32 while(i < text.length() && text.charAt(i) ==
'0')
35 while(i > -1 && i < text.length() && text.charAt(i) ==
'0')
36 text.deleteCharAt(i--);
38 text.insert(i + 1,
'.');
39 return text.toString();
42 public static String
expand(String a) {
43 if((a ==
null) || (a.length() == 0))
45 StringBuilder text =
new StringBuilder(a.trim());
47 if((i = text.lastIndexOf(
".")) > -1) {
55 i = text.lastIndexOf(
"0");
61 return text.toString();
65 if(a ==
null)
return false;
69 if((a.charAt(i) <
'0') || (a.charAt(i) >
'9'))
75 if(a ==
null)
return false;
76 if(a.length() >= 10)
return false;
77 for(
int i = 0; i < a.length(); i++)
78 if(((a.charAt(i) <
'0') || (a.charAt(i) >
'9')) && !(a.charAt(i) ==
'.'))
83 public static String
trim(String a) {
84 StringBuilder text =
new StringBuilder(a);
85 while((text.length() > 0) && (text.charAt(text.length() - 1) ==
'0'))
86 text.deleteCharAt(text.length() - 1);
87 return text.toString();