gpt4 book ai didi

ios - (iOS + Swift) 如何在我的 Firebase 实时数据库中允许特殊字符?

转载 作者:行者123 更新时间:2023-11-28 15:35:46 25 4
gpt4 key购买 nike

使用 iOS + Swift,在我的 Firebase 数据库键(节点名称)中允许特殊字符 .$#[]/的最佳方法是什么?

最佳答案

添加百分比编码和解码!请记住允许使用字母数字字符(请参见下面的示例)。

var str = "this.is/a#crazy[string]right$here.$[]#/"

if let strEncoded = str.addingPercentEncoding(withAllowedCharacters: .alphanumerics) {
print(strEncoded)

if let strDecoded = strEncoded.removingPercentEncoding {
print(strDecoded)
}
}

关于ios - (iOS + Swift) 如何在我的 Firebase 实时数据库中允许特殊字符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44292469/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com