Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Insert integer to Arabic String in Start

Tags:

string

c#

arabic

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 ?

like image 981
user889030 Avatar asked Sep 22 '14 17:09

user889030


1 Answers

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.

like image 134
Habib Avatar answered Nov 13 '22 06:11

Habib