0

i need change the word ي to ی in jtext field if user write ي in jtext field that word must be change to ی like this شیمي = شیمی ي = ی I think I should use the listener and keyrelease but I do not know how?! or change ی to م for me? شیمی = شیمم every time user use ی in my jtext replace م

  • ي is the same as يي in Arabic. and the code for both letters whether it is in the beginning or end is the same. What you need to do here is replace all ي in the end of the sentence and this can be done using replaceAll method when a string ends with ي in the scope of JTextFeild listener method – Ahmad Sanie Dec 11 '17 at 11:53
  • this ي is Arabic and ی is Persian some times when importing and searching for data Creates a problem for users – maysam soleymani Dec 11 '17 at 11:56
  • `i need change the word` is the same as `in jtext field if user write` is the same as `in jtext field that word must be change to `... and its not english? – XtremeBaumer Dec 11 '17 at 11:56
  • @maysamsoleymani both ي and ى are Arabic letters. – Ahmad Sanie Dec 11 '17 at 11:58
  • this not same ي is Arabic and ی is persian – maysam soleymani Dec 11 '17 at 12:01
  • ی = ascii = 237 and ي=ascii=236 but you can change ی to م ? – maysam soleymani Dec 11 '17 at 12:23
  • Hello and welcome to StackOverflow. Please take some time to read the help page, especially the sections named ["What topics can I ask about here?"](http://stackoverflow.com/help/on-topic) and ["What types of questions should I avoid asking?"](http://stackoverflow.com/help/dont-ask). And more importantly, please read [the Stack Overflow question checklist](http://meta.stackexchange.com/q/156810/204922). You might also want to learn about [Minimal, Complete, and Verifiable Examples](http://stackoverflow.com/help/mcve). – Clijsters Dec 11 '17 at 12:53

1 Answers1

1

i find this way

    String a = jTextField1.getText();
    String b = a.replace("ي", "ی");
    jTextField1.setText(b);

    String c = jTextField1.getText();
    String d = c.replace("ك", "ک");
    jTextField1.setText(d);