Subversion Repositories eFlore/Applications.del

Rev

Rev 1505 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1062 benjamin 1
package org.tela_botanica.del.client.utils;
2
 
3
public class StringUtils {
4
 
5
	public static boolean checkStringNotNull(String s){
6
		if(s!=null&&!s.equals("")){
7
			return true;
8
		}
9
		return false;
10
	}
1165 aurelien 11
 
12
	public static String normaliser(String mot) {
13
 
14
		mot = mot.toLowerCase().trim().replace(" ", "");
15
 
16
		// Le manque de support des librairies standard java
17
		// nous oblige à utiliser cette méthode un peu batarde
18
		char[] accents = {'à','á','â','ã','ä','ç','è','é','ê','ë','ì','í','î','ï','ñ','ò','ó','ô','õ','ö','ù','ú','û','ü','ý','ÿ','À','Á','Â','Ã','Ä','Ç','È','É','Ê','Ë', 'Ì','Í','Î','Ï','Ñ','Ò','Ó','Ô','Õ','Ö','Ù','Ú','Û','Ü','Ý'};
19
		char[] sansAccents = {'a','a','a','a','a','c', 'e','e','e','e','i','i','i','i','n','o','o','o','o','o','u','u','u','u', 'y','y','A','A','A','A','A','C','E','E','E','E','I','I','I','I','N','O','O','O','O','O','U','U','U','U','Y'};
20
 
21
		for (int i = 0; i < accents.length; i++) {
22
			mot = mot.replace(accents[i], sansAccents[i]);
23
		}
24
 
25
		return mot;
26
	}
1525 mathias 27
 
28
	public static native void logChaine(String s) /*-{
29
		if(!!($wnd.console && $wnd.console.log)) {
30
			$wnd.console.log(s);
31
		}
32
	}-*/;
1062 benjamin 33
}