Subversion Repositories eFlore/Applications.coel

Rev

Rev 948 | Rev 954 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
619 gduche 1
package org.tela_botanica.client.util;
2
 
3
public class UtilString {
4
 
5
	/**
6
	 *  Mets la première lettre d'une chaine en majuscule
7
	 *
8
	 *  @param chaineDeCaractere
9
	 *  @result ChaineDeCaractere
10
	 */
11
 
12
	public static String ucFirst(String inputStr)	{
798 gduche 13
		if (isEmpty(inputStr))	{
674 gduche 14
			return "";
15
		}
619 gduche 16
		return inputStr.substring(0,1).toUpperCase() + inputStr.substring(1, inputStr.length());
17
	}
798 gduche 18
 
19
	public static boolean isEmpty(String inputStr)	{
20
		return inputStr == null || inputStr.equals("");
21
	}
948 jpm 22
 
23
	public static double formaterEnDouble(String nombre)	{
24
		if (!isEmpty(nombre)) {
25
			return Double.parseDouble(nombre);
26
		}
27
		return new Double(0);
28
	}
949 jpm 29
 
30
	public static int formaterEnEntier(String nombre)	{
31
		if (!isEmpty(nombre)) {
32
			return Integer.parseInt(nombre);
33
		}
34
		return new Integer(0);
35
	}
619 gduche 36
}