Chamilo is a learning management system focused on ease of use and accessibility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chamilo-lms/main/inc/lib/ppt2png/StringOperation.java

144 lines
5.2 KiB

import java.util.Vector;
/**
* Classe complementaire du J2SDK sur la manipulation de chaines de caract<EFBFBD>res
* Permet nottament de supprimer les accents d'une chaine de caract<EFBFBD>res
*/
public abstract class StringOperation {
/** Index du 1er caractere accentu<EFBFBD> * */
private static final int MIN = 192;
/** Index du dernier caractere accentu<EFBFBD> * */
private static final int MAX = 255;
/** Vecteur de correspondance entre accent / sans accent * */
private static final Vector map = initMap();
/**
* Initialisation du tableau de correspondance entre les caract<EFBFBD>res
* accentu<EFBFBD>s et leur homologues non accentu<EFBFBD>s *
*/
private static Vector initMap() {
Vector Result = new Vector();
java.lang.String car = null;
car = new java.lang.String("A");
Result.add(car); /* '\u00C0' <EFBFBD> alt-0192 */
Result.add(car); /* '\u00C1' <EFBFBD> alt-0193 */
Result.add(car); /* '\u00C2' <EFBFBD> alt-0194 */
Result.add(car); /* '\u00C3' <EFBFBD> alt-0195 */
Result.add(car); /* '\u00C4' <EFBFBD> alt-0196 */
Result.add(car); /* '\u00C5' <EFBFBD> alt-0197 */
car = new java.lang.String("AE");
Result.add(car); /* '\u00C6' <EFBFBD> alt-0198 */
car = new java.lang.String("C");
Result.add(car); /* '\u00C7' <EFBFBD> alt-0199 */
car = new java.lang.String("E");
Result.add(car); /* '\u00C8' <EFBFBD> alt-0200 */
Result.add(car); /* '\u00C9' <EFBFBD> alt-0201 */
Result.add(car); /* '\u00CA' <EFBFBD> alt-0202 */
Result.add(car); /* '\u00CB' <EFBFBD> alt-0203 */
car = new java.lang.String("I");
Result.add(car); /* '\u00CC' <EFBFBD> alt-0204 */
Result.add(car); /* '\u00CD' <EFBFBD> alt-0205 */
Result.add(car); /* '\u00CE' <EFBFBD> alt-0206 */
Result.add(car); /* '\u00CF' <EFBFBD> alt-0207 */
car = new java.lang.String("D");
Result.add(car); /* '\u00D0' <EFBFBD> alt-0208 */
car = new java.lang.String("N");
Result.add(car); /* '\u00D1' <EFBFBD> alt-0209 */
car = new java.lang.String("O");
Result.add(car); /* '\u00D2' <EFBFBD> alt-0210 */
Result.add(car); /* '\u00D3' <EFBFBD> alt-0211 */
Result.add(car); /* '\u00D4' <EFBFBD> alt-0212 */
Result.add(car); /* '\u00D5' <EFBFBD> alt-0213 */
Result.add(car); /* '\u00D6' <EFBFBD> alt-0214 */
car = new java.lang.String("*");
Result.add(car); /* '\u00D7' <EFBFBD> alt-0215 */
car = new java.lang.String("0");
Result.add(car); /* '\u00D8' <EFBFBD> alt-0216 */
car = new java.lang.String("U");
Result.add(car); /* '\u00D9' <EFBFBD> alt-0217 */
Result.add(car); /* '\u00DA' <EFBFBD> alt-0218 */
Result.add(car); /* '\u00DB' <EFBFBD> alt-0219 */
Result.add(car); /* '\u00DC' <EFBFBD> alt-0220 */
car = new java.lang.String("Y");
Result.add(car); /* '\u00DD' <EFBFBD> alt-0221 */
car = new java.lang.String("<EFBFBD>");
Result.add(car); /* '\u00DE' <EFBFBD> alt-0222 */
car = new java.lang.String("B");
Result.add(car); /* '\u00DF' <EFBFBD> alt-0223 */
car = new java.lang.String("a");
Result.add(car); /* '\u00E0' <EFBFBD> alt-0224 */
Result.add(car); /* '\u00E1' <EFBFBD> alt-0225 */
Result.add(car); /* '\u00E2' <EFBFBD> alt-0226 */
Result.add(car); /* '\u00E3' <EFBFBD> alt-0227 */
Result.add(car); /* '\u00E4' <EFBFBD> alt-0228 */
Result.add(car); /* '\u00E5' <EFBFBD> alt-0229 */
car = new java.lang.String("ae");
Result.add(car); /* '\u00E6' <EFBFBD> alt-0230 */
car = new java.lang.String("c");
Result.add(car); /* '\u00E7' <EFBFBD> alt-0231 */
car = new java.lang.String("e");
Result.add(car); /* '\u00E8' <EFBFBD> alt-0232 */
Result.add(car); /* '\u00E9' <EFBFBD> alt-0233 */
Result.add(car); /* '\u00EA' <EFBFBD> alt-0234 */
Result.add(car); /* '\u00EB' <EFBFBD> alt-0235 */
car = new java.lang.String("i");
Result.add(car); /* '\u00EC' <EFBFBD> alt-0236 */
Result.add(car); /* '\u00ED' <EFBFBD> alt-0237 */
Result.add(car); /* '\u00EE' <EFBFBD> alt-0238 */
Result.add(car); /* '\u00EF' <EFBFBD> alt-0239 */
car = new java.lang.String("d");
Result.add(car); /* '\u00F0' <EFBFBD> alt-0240 */
car = new java.lang.String("n");
Result.add(car); /* '\u00F1' <EFBFBD> alt-0241 */
car = new java.lang.String("o");
Result.add(car); /* '\u00F2' <EFBFBD> alt-0242 */
Result.add(car); /* '\u00F3' <EFBFBD> alt-0243 */
Result.add(car); /* '\u00F4' <EFBFBD> alt-0244 */
Result.add(car); /* '\u00F5' <EFBFBD> alt-0245 */
Result.add(car); /* '\u00F6' <EFBFBD> alt-0246 */
car = new java.lang.String("/");
Result.add(car); /* '\u00F7' <EFBFBD> alt-0247 */
car = new java.lang.String("0");
Result.add(car); /* '\u00F8' <EFBFBD> alt-0248 */
car = new java.lang.String("u");
Result.add(car); /* '\u00F9' <EFBFBD> alt-0249 */
Result.add(car); /* '\u00FA' <EFBFBD> alt-0250 */
Result.add(car); /* '\u00FB' <EFBFBD> alt-0251 */
Result.add(car); /* '\u00FC' <EFBFBD> alt-0252 */
car = new java.lang.String("y");
Result.add(car); /* '\u00FD' <EFBFBD> alt-0253 */
car = new java.lang.String("<EFBFBD>");
Result.add(car); /* '\u00FE' <EFBFBD> alt-0254 */
car = new java.lang.String("y");
Result.add(car); /* '\u00FF' <EFBFBD> alt-0255 */
Result.add(car); /* '\u00FF' alt-0255 */
return Result;
}
/**
* Transforme une chaine pouvant contenir des accents dans une version sans
* accent
*
* @param chaine
* Chaine a convertir sans accent
* @return Chaine dont les accents ont <EFBFBD>t<EFBFBD> supprim<EFBFBD>
*/
public static java.lang.String sansAccent(java.lang.String chaine) {
java.lang.StringBuffer Result = new StringBuffer(chaine);
for (int bcl = 0; bcl < Result.length(); bcl++) {
int carVal = chaine.charAt(bcl);
if (carVal >= MIN && carVal <= MAX) { // Remplacement
java.lang.String newVal = (java.lang.String) map.get(carVal
- MIN);
Result.replace(bcl, bcl + 1, newVal);
}
}
return Result.toString();
}
}