6

I am trying to add integer to Arabic string but no success

// Arabic String  
Astr = "سُوْرَةُ الْفَاتِحَة";
// String with Integer   -1
num = "-"+1;
// Adding Strings
r = Astr + num;  
r = num + Astr;

output : سُوْرَةُ الْفَاتِحَة-1

Desired output:

سُوْرَةُ الْفَاتِحَة‎-1

I want the integer on the right side .

Update : Am displaying this result in ListBox in visual studio by using Items.Insert() Method , so if anyone know to tweak ListBox then kindly share I mean if ListBox display Numbers 1 2 3 4 with each row ?

Habib
  • 219,104
  • 29
  • 407
  • 436
user889030
  • 4,353
  • 3
  • 48
  • 51
  • Did you try using the integer `-1` instead of adding a dash and an integer `1`? – HABO Sep 22 '14 at 17:18
  • @HABO ya it tried with 1 too without dash ...... but same result – user889030 Sep 22 '14 at 17:23
  • @Alex thanks for suggestion but "-1" not worked same result :( – user889030 Sep 22 '14 at 17:34
  • 2
    This is not a bad question, I can't really seem to even type it in comment `سُوْرَةُ الْفَاتِحَة` with - 1 – Habib Sep 22 '14 at 17:37
  • @Habib ya i tried too :D we need someone expert to answer that question – user889030 Sep 22 '14 at 17:39
  • 1
    Can you use a seperate control to display the number sign? You can try to blend the two part together by using no boundary line but the same background color. – Tianyun Ling Sep 22 '14 at 17:41
  • I beleive it has to do with culture info, right to left vs left to right. – Sorceri Sep 22 '14 at 17:41
  • @TianyunLing do you have link to any example related to this technique , but using no boundary line – user889030 Oct 02 '14 at 18:39
  • It is a walk around (or cheat) rather than a technique. You can change the style of the control in the design panel (maybe make them transparent). And have a bigger background panel contains the two controls to make them looks as one. – Tianyun Ling Oct 02 '14 at 18:47

1 Answers1

13

Use Unicode LRM (200F)

string Astr = "سُوْرَةُ الْفَاتِحَة";
var num = "-1";
var LRM = ((char)0x200E).ToString(); 
var result = Astr + LRM + num;

and you will get: result = "سُوْرَةُ الْفَاتِحَة‎-1"

See: HOW TO: Formatting Control Characters

LRM ==> Left-to-Right Mark ==> 200E ==> Acts as a Latin character.

Habib
  • 219,104
  • 29
  • 407
  • 436