Adding Firebase data, dots and forward slashes

后端 未结 9 2070
长情又很酷
长情又很酷 2020-12-01 12:32

I try to use firebase db, I found very important restrictions, which are not described in firebase help or FAQ.

First problem is that symbol: dot \'.\' prohibited in

9条回答
  •  伪装坚强ぢ
    2020-12-01 13:12

    If you're using Swift 3, this works for me (try it in a playground):

    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)
        }
    }
    

提交回复
热议问题