添加阿拉伯语字符串中的空格

问题描述 投票:0回答:1

我正在尝试在字符串中添加空白,但是添加后没有显示空格,如果我检查String的长度,它会显示不同的空格,但显示中没有空格

下面是我的代码和相同的屏幕截图。

    let apple = "apple"
    var arabictext = "بيتزا صغيرة بالجبنة‎"

    // here space works
    let ababictextWithSpace = "\(apple)      \(arabictext)"
    print(ababictextWithSpace)

    // here space not work
    var ababictextWithSpace2 = "      \(arabictext)     "
    print(arabictext)




    let str = String(data: arabictext.data(using: .utf8)!, encoding: .utf8)
    print("\(str!)".count)
    print("    \(str!)".count)

带有输出的屏幕截图。

enter image description here

ios swift arabic arabic-support
1个回答
0
投票

In my case也许是控制台的错误。实际上,它们是不同的,大小不同的东西证明了这一点。

© www.soinside.com 2019 - 2024. All rights reserved.