2

If we want to iterate through the characters of a string in Java we can do like this

String s = "... ahmad sardar awais ,.l. dausaj";

        for (int i = 0; i < s.length(); i++){
            char c = s.charAt(i);
            System.out.println( c );
         }

But my problem is that I have punjabi or Arabic language in my Arraylist then how to iterate and get single character ?

My String in ArrayList is مجھے اچھا لڑکا ہوں

Now I want this String Split in single character, how to do this ?

eldo
  • 1,327
  • 2
  • 16
  • 27
Ahmad
  • 1,462
  • 5
  • 17
  • 40
  • What's the behaviour when you split Punjabi/Arabic text? Doesn't it work as expected? – ByteWelder Jun 27 '16 at 11:36
  • It cannot traverse character by character, whole word traversed – Ahmad Jun 27 '16 at 11:39
  • You might need codepoints for this. http://stackoverflow.com/questions/1527856/how-can-i-iterate-through-the-unicode-codepoints-of-a-java-string or http://stackoverflow.com/a/1031647/3848666 – ByteWelder Jun 27 '16 at 11:46

0 Answers0