Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/111.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 从数组中删除前缀文本_Ios_Objective C_Xcode - Fatal编程技术网

Ios 从数组中删除前缀文本

Ios 从数组中删除前缀文本,ios,objective-c,xcode,Ios,Objective C,Xcode,从数组中每个数据的前缀中删除CLBeacon文本 “CLBeacon(uuid:F7826DA6-4FA2-4E98-8024-BC5B71E0893E,大调:20310,小调:48417,接近度:0+/-1.00m,rssi:0)” 我想删除CLBeacon文本和要添加到数组中的内部数据。通常,您可以使用map和substring执行此操作 let prefixText = "CLBeacon" let prefixCount = prefixText.characters.count let

从数组中每个数据的前缀中删除CLBeacon文本

“CLBeacon(uuid:F7826DA6-4FA2-4E98-8024-BC5B71E0893E,大调:20310,小调:48417,接近度:0+/-1.00m,rssi:0)”


我想删除CLBeacon文本和要添加到数组中的内部数据。

通常,您可以使用
map
substring
执行此操作

let prefixText = "CLBeacon"
let prefixCount = prefixText.characters.count
let arrayWithoutPrefixes = array.map { $0.substring(from: $0.characters.index($0.startIndex, offsetBy: prefixCount)) }

remove CLBeancon text是什么意思?它看起来像是结构的隐式
description
属性的输出。为什么不实现自己的
description
来返回所需内容。不要将对象的
description
值用于调试日志记录以外的任何事情。获取CLBeacon对象的属性,并首次使用CLBeacons构建stringOK