.Net中的Unicode字符串,带有希伯来字母和数字 [英] Unicode strings in .Net with Hebrew letters and numbers

查看:98
本文介绍了.Net中的Unicode字符串,带有希伯来字母和数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试创建包含希伯来字母和数字的字符串时,有一个奇怪的行为.该数字将始终显示在字母的左侧.例如:

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:

string A = "\u05E9"; //A Hebrew letter
string B = "23";
string AB = A + B;
textBlock1.Text = AB;
//Ouput bug - B is left to A.

此错误仅在同时使用希伯来字母和数字时才会发生.当从等式中删除其中一个时,该错误将不会发生:

This bug only happens when using both a Hebrew letter and digits. When omitting one of those from the equation the bug won't happen:

string A = "\u20AA"; //Some random Unicode.
string B = "23";
string AB = A + B;
textBlock1.Text = AB;
//Output OK.

string A = "\u05E9"; //A Hebrew letter.
string B = "HELLO";
string AB = A + B;
textBlock1.Text = AB;
//Output OK.

我尝试使用FlowDirection属性,但没有帮助.

I tried playing with FlowDirection property but it didn't help.

欢迎采用一种变通方法来使文本在第一个代码示例中正确显示.

A workaround to get the text displayed properly in the first code exmaple would be welcomed.

推荐答案

string A = "\u05E9"; //A Hebrew letter
string B = "23";
string AB = B + A; // !
textBlock1.Text = AB;
textBlock1.FlowDirection = FlowDirection.RightToLeft;
//Ouput Ok - A is left to B as intended.

这篇关于.Net中的Unicode字符串,带有希伯来字母和数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆