I get an error when I do the following operation.
public static String text = "ng";
public static String[] specialConsonants = new String[4];
public static String[] specialConsonantsUni = new String[6];
public void setSpecial(){
specialConsonantsUni[0] = "ං";
specialConsonants[0] = "ng";
specialConsonantsUni[1] = "ඃ";
specialConsonants[1] = "h/g";
specialConsonantsUni[2] = "ඞ";
specialConsonants[2] = "N/g";
specialConsonantsUni[3] = "ඍ";
specialConsonants[3] = "R/g";
// special characher Repaya
specialConsonantsUni[4] = "ර්" + "\u200D";
specialConsonants[4] = "/R/g";
specialConsonantsUni[5] = "ර්" + "\u200D";
specialConsonants[5] = "/\\r/g";
}
public static void main(String args[]){
for (int i=0; i < specialConsonants.length; i++){
text = text.replace(specialConsonants[i], specialConsonantsUni[i]);
System.out.println(text);
}
}
I'm trying to create a locale app. So you may not see some fonts. The error is following.
Exception in thread "main" java.lang.NullPointerException
at java.lang.String.replace(Unknown Source)
at in.isuru.srtuc.Stuff.main(Stuff.java:223)
setSpecial()
method to initialize the values of the array – Luiggi Mendoza Feb 26 '12 at 15:57