从转换为字符串的数组值中删除括号

时间:2018-11-22 01:29:58

标签: ios swift textview

我有一个textview,并且在显示文本时,文本中带有括号。我想消除它们。这是我的代码:

self.txtpstn.text =  "\(self.no_pstn.self as NSArray)"
self.txtmobile.text =  "\(self.no_mobile.self as NSArray)"

这是应用程序上的显示:

enter image description here

1 个答案:

答案 0 :(得分:1)

使用连接:

self.txtpstn.text =  "\((self.no_pstn.self as NSArray).componentsJoined(by: ","))"
self.txtmobile.text =  "\(self.no_mobile.self as NSArray).componentsJoined(by: ","))"