var? str ="15037919912"
? ? ? ? letstartIndex = str.index(str.startIndex, offsetBy:3)
? ? ? ? letendIndex = str.index(str.startIndex, offsetBy:6)
? ? ? ? let? range = startIndex...endIndex
? ? ? ? //str.replaceSubrange(range, with: "Object -")
? ? ? ? str.replaceSubrange(range, with:"****")
? ? ? ? print("替換范圍后的+\(str)")//150****9912
? ? ? ? var str1 = "410311199301095011"
? ? ? ? letstartIndexs = str1.index(str1.startIndex, offsetBy:6)
? ? ? ? letendIndexs = str1.index(str1.startIndex, offsetBy:13)
? ? ? ? let? ranges = startIndexs...endIndexs
? ? ? ? str1.replaceSubrange(ranges, with:"********")
? ? ? ? print("替換范圍后的+\(str1)")//410311********5011