Hi guys,

I'm trying to read a file which contains text in arabic. The file text is aligned from right to left. But when I read it, the output is from left to right. Is there any way to align it from right to left? I'm trying to display the contents on the console.

try this;

public class R2L
{
  public R2L()
  {
    super();
    String s = "hello";
    reversedPrintln(s);
  }

  public static void main(String[] args)
  {
    R2L r2L = new R2L();
  }

  public void reversedPrint(String string)
  {
    for(int index = string.length() - 1; index >= 0; index--)
      System.out.print(string.charAt(index));
  }

  public void reversedPrintln(String string)
  {
    reversedPrint(string);
    System.out.println();
  }
}

Hey thanks. Instead of writing to the console if i write to a file instead it seems to work fine, though only on linux. On windows the output is still wrong. Weird.
Thanks again. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.