本文介绍了Swift 中带有打印或 println 的文本方向,用于混合文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 println 或 Swift 中的打印函数打印一个带有希伯来字符א - aleph is a quiet..."的字符串.下面的简单代码有一个输出,其中第一个字符从右到左 (RTL) 打印,其余文本从左到右 (LTR) 打印.我该如何更改它,使其全部打印 LTR.

I am attempting to print a string with a hebrew character "א - aleph is a silent..." using println or print functions in Swift. The simple code below has an output with the first character printed right-to-left (RTL) and the rest of the text left-to-right (LTR). How can I change this so it is all printed LTR.

提前致谢.

var content:String="\u{05D0} - aleph is a silent consonant - however it is pronounced as a, o, e, i or u based on the vowel used."

println(content)

输出应该是:

א - aleph is a silent consonant - however it is pronounced as a, o, e, i or u based on the vowel used.

然而,希伯来字符打印在该行的右侧.

However the hebrew character is printed on the right of the line.

推荐答案

看来我找到了答案.添加\u{200E}",字符前的从左到右标记解决问题.

It looks like I found the answer. Adding "\u{200E}", the Left to Right Mark before the character resolves the issue.

更多信息:http://en.wikipedia.org/wiki/Left-to-right_mark

这篇关于Swift 中带有打印或 println 的文本方向,用于混合文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 07:43