I'm trying to concatenate an Arabic string with a leading DateTime, I have tried in various way but the DateTime always ends up at the end of the string
var arabicText = "Jim قام بإعادة تعيين هذه المهمة إلى John";
var dateTime = DateTime.Now;
System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("ar-AE");
string test1 = arabicText + " :" + dateTime.ToString();
string test2 = arabicText + " :" + dateTime.ToString(ci);
So when this is displayed it should show
Jim قام بإعادة تعيين هذه المهمة إلى John :02/10/2012
but I always seem to end up with
02/10/2012: Jim قام بإعادة تعيين هذه المهمة إلى John
Any ideas would be apprecicated
You can use with this code
var strArabic = "Jim قام بإعادة تعيين هذه المهمة إلى John";
var strEnglish = dateTime.ToString() ;
var LRM = ((char)0x200E).ToString(); // This is a LRM
var result = strArabic + LRM + strEnglish ;
Try using string.Format
:
string test1 = string.Format("{0}: {1}", arabicText, dateTime.ToString());
That should produce the result you're looking for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With