Unicode strings in .Net with Hebrew letters and numbers

前端 未结 4 1354
梦如初夏
梦如初夏 2021-02-04 15:38

There is a strange behavior when trying to create string which contains a Hebrew letter and a digit. The digit will always be displayed left to the letter. For example:

<
4条回答
  •  醉梦人生
    2021-02-04 15:58

    The unicode characters "RTL mark" (U+200F) and "LTR mark" (U+200E) were created precisely for this purpose.

    In your example, simply place an LTR mark after the Hebrew character, and the numbers will then be displayed to the right of the Hebrew character, as you wish.

    So your code would be adjusted as follows:

    string A = "\u05E9"; //A Hebrew letter
    string LTRMark = "\u200E"; 
    string B = "23";
    string AB = A + LTRMark + B;
    

提交回复
热议问题