user889030
user889030

Reputation: 4764

Insert integer to Arabic String in Start

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 ?

Upvotes: 6

Views: 1328

Answers (1)

Habib
Habib

Reputation: 223282

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.

Upvotes: 13

Related Questions