Character Direction in Persian Words mixed with Symbols

Viewed 42

I will type the whole word with Persian keyboard:

enter image description here

Now I will loop through its letters and will create a new string like this:

string word = "";
for(int i=0; i < target.Length; i++)
  word += target[i];

then I will print it, and here is the result:

enter image description here

It is the same as the source typed one.

Now I will re-typed the word, but when I reach a symbol I will change my keyboard to English:

enter image description here

again, I will loop and create a new string and will print it, here is the result:

enter image description here

as you can see there is a problem, the symbols part will hit in a reverse way! I should hit the # first, but the loop will hit the @ first! The symbols will hit reverse in loop, cuz they are typed with English keyboard layout.

so the for loop, will hit characters in the order as they typed, But I need to hit the characters in the order they will shown on screen.

1 Answers

How can you convert Latin Letters into persian letters manually? You could convert text into ASCII, and based on what the ascii is, the ASCIIs of latin letters can be convertedd into Persian letters in ASCII and could be added into a string.

How can you prevent keyboard shortcuts from changing keyboard input/language? The application you are focused onto could be forced to ingore the input just so that you can do manual typing (manually detecting keyboard input).

How can you force the input field to stay on the right side? You could use this code to force your input field to keep right. (Code from Right align text inside a TextBox page of StackOverflow)

textBox1.TextAlign = HorizontalAlignment.Right;

Or you could go to the input field's properties and look for a property that mentions something about Text Alignment (Default is Left. You can change it to Right).

Related