Im making an app that makes Arabic letters tall(by adding this ــــ after each letter) so i have to replace every signle letter(about 24 letters).
I've created an array this way:
String sub ="ــــ";
String arabicLetters="ج@ح@خ@@ه@ع@غ@ف@ق@ث@ص@ض@ط@ك@م@ن@ت@ل@ب@ي@س@ش@ظ@ئ"; //Will be splitted by split("@")
String arabicLettersArr[];
arabicLettersArr=arabicLetters.split("@");
Now i have done the array.
Here is the replacing function:
public void makeLettersTall(View v){
String text = edt.getText().toString().trim();
if(!text.equals("")){
for(String letter: arabicLettersArr){
text = text.replace(letter,letter+sub);
}
edt.setText(text);
}
}
The problem:
let's say that i entered the letter ب
so i expect it to be بــــ but what i get is ــــــــبــــ
it seems that this symbole ــــ
was added twice before letter and once after while i want to be added only once after😔.