Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 1672 → Rev 2276

/trunk/src/org/tela_botanica/client/util/Util.java
301,4 → 301,22
s = s.indexOf(".") < 0 ? s : s.replaceAll("0*$", "").replaceAll("\\.$", "");
return s;
}
 
// Prend un nombre décimal avec le spéparateur spécifié et le tronque à n décimales
public static String tronquerNombrePourAffichage(String nombre, int decimales, char separateur) {
String retour = nombre;
int posSep = nombre.indexOf(separateur);
if (posSep >= 0) {
int taille = posSep + decimales + 1;
if (nombre.length() < taille) {
taille = nombre.length();
}
retour = nombre.substring(0, taille);
}
return retour;
}
 
public static String tronquerNombrePourAffichage(String nombre, int decimales) {
return tronquerNombrePourAffichage(nombre, decimales, '.');
}
}