RTL显示的数字在每行结束 [英] RTL shows numbers at the end of lines

查看:138
本文介绍了RTL显示的数字在每行结束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图显示以数字开头希伯来字符串,总​​是在字符串像这样的结尾显示数字:1יוםשישיבבוקר

Trying to display a hebrew string that starts with a number, always displays the number at the end of the string like so: 1. יום שישי בבוקר

,但我需要在右侧的文本要显示的数 -

but I need the number to be displayed at the right side of the text-

任何解决办法吗?

这发生在的UILabel和放大器;的UITextField和放大器;的UITextView

It happens with UILabel & UITextField & UITextView

和试图写在左侧的数目也产生同样的resault

and trying to write the number at the left side also produce the same resault.

与UITextAlignment的组合演奏会并没有帮助。

Playing with combinations of UITextAlignment will doesn't help.

推荐答案

您不必更改的UILabel任何设置,只要把人物与UNI $ C C 0x200F $您的字符串之前。这是什么原因:

You don't need to change any setting on UILabel, just put the character with unicode 0x200F before your string. This is the reason:

在统一code很多人物都有特定的方向性,它可以让系统知道它已被写入,说LTR,像سلام。段落通常使用的第一个字符的方向。这就是为什么你的字符串没有数量从右类型为自动离开。

In Unicode many characters have a specific directionality, which lets the system know it has to be written, say LTR, like سلام. The paragraph usually uses the direction of its first character. That's why your string without the number is typed from right to left automatically.

现在一些字符,相同的数字,有弱的方向性,所以他们基本上采取它们的周边。当你输入1בבוקר,该系统第一次看到1,所以需要平时的LTR方向。更改排列也无济于事,因为它只是转移了整个文本的权利,或中心。

Now some characters, like numbers, have "weak" directionality, so they basically take that of their surrounding. When you type "1. בבוקר", the system first sees 1, so takes the usual LTR direction. Changing the alignment won't help, as it just shifts the whole text to right, or center.

要解决这个问题,统一code有两个标记字符(LTR:0x200E,RTL:200F)。这些都是无形的,但规定的方向性。因此,尽管1בבוקר是......

To solve this issue, Unicode has two marker characters (LTR: 0x200E, RTL:200F). These are invisible, but dictate the directionality. So while "1. בבוקר" is...

  1. בבוקר

如果你输入#x200F+1בבוקר,它会显示如下:

if you type "#x200F" + "1. בבוקר" it will display like this:

1。 בבוקר

这篇关于RTL显示的数字在每行结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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