I am trying to convert the English numbers to Bengali numbers before filling the report. The data i am getting from MySQL:
SELECT brand.id,brand.brand,model.
You also could create a replacement String in the Java code and use it in the parameters map:
String replacedOne = one.getText().replaceAll("0","০").replaceAll("1","১").replaceAll("2","২").replaceAll("3","৩").replaceAll("4","৪").replaceAll("5","৫").replaceAll("6","৬").replaceAll("7","৭").replaceAll("8","৮").replaceAll("9","৯");
parameters.put("replacedID",replacedOne);
Or better, you can perform the replacement directly in your jrxml file, with no need to modify the java file, by using this (very long) expression instead of $F{model}:
$F{model}.replaceAll("0","০").replaceAll("1","১").replaceAll("2","২").replaceAll("3","৩").replaceAll("4","৪").replaceAll("5","৫").replaceAll("6","৬").replaceAll("7","৭").replaceAll("8","৮").replaceAll("9","৯");
For new Learner
private String getStringInBangla(String string) {
Character[] bangla_number = {'০', '১', '২', '৩', '৪', '৫', '৬', '৭', '৮', '৯'};
Character[] eng_number = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
StringBuilder values = new StringBuilder();
char[] character = string.toCharArray();
for (char value : character) {
char c = ' ';
for (int j = 0; j < eng_number.length; j++) {
if (value == eng_number[j]) {
c = bangla_number[j];
break;
} else {
c = value;
}
}
values.append(c);
}
return values.toString();
}