I am trying to write a number with a custom formatting in a right-to-left textbox(actually in a listview but whatever). here is the code:
NumberFormatInfo nfi = (NumberFormatInfo)
CultureInfo.InvariantCulture.NumberFormat.Clone();
nfi.NumberGroupSeparator = " ";
textbox1.Text = (18700).ToString("#,###",nfi);
instead of 18 700
i get 700 18
. can i fix this(get the required 18 700
) without manipulating the string after number to string conversion?
Instead of a space, use a no-break space. It's character is (char)0x00A0
or '\u00A0'
in C#. You can also type it using keyboard using Alt+255.
So you can set NumberGroupSeparator
this way:
nfi.NumberGroupSeparator = "\u00A0";