Rev 1165 | Rev 1953 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
package org.tela_botanica.del.client.utils;
public class StringUtils {
public static boolean checkStringNotNull(String s){
if(s!=null&&!s.equals("")){
return true;
}
return false;
}
public static String normaliser(String mot) {
mot = mot.toLowerCase().trim().replace(" ", "");
// Le manque de support des librairies standard java
// nous oblige à utiliser cette méthode un peu batarde
char[] accents = {'à','á','â','ã','ä','ç','è','é','ê','ë','ì','í','î','ï','ñ','ò','ó','ô','õ','ö','ù','ú','û','ü','ý','ÿ','À','Á','Â','Ã','Ä','Ç','È','É','Ê','Ë', 'Ì','Í','Î','Ï','Ñ','Ò','Ó','Ô','Õ','Ö','Ù','Ú','Û','Ü','Ý'};
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'};
for (int i = 0; i < accents.length; i++) {
mot = mot.replace(accents[i], sansAccents[i]);
}
return mot;
}
public static native void logChaine(String s) /*-{
if(!!($wnd.console && $wnd.console.log)) {
$wnd.console.log(s);
}
}-*/;
}