这是我的整个字符串
“818 22nd St,West Palm Beach,FL 33407 2间卧室| 1间浴室| CBS房屋全部装修|全新房价每月租金$ 1150起价$ 94,000现金或硬币请注意所有优惠只限现金或硬币(否)抵押贷款现金优惠只有)请注意所有优惠都是零突发事件(noRead more“
我想删除字符串
的这一部分“818 22nd St,West Palm Beach,FL 33407 2间卧室|”
这是我用过但没有运气的解决方案
第一个字符串是描述,第二个是标题,我想从描述中删除标题
let string = properties!["description"]
let removeString = properties!["title"]
let newString = string?.replacingOccurrences(of: removeString, with: "")
print(newString)
答案 0 :(得分:0)
我们的问题应该有更多的信息。但就目前而言,正确的回答是......
let string = "818 22nd St, West Palm Beach, FL 33407 2 bedrooms | 1 bath | CBS house Totally renovated | Everything new Rented for $1150 a month ASKING $94,000 CASH OR HARD MONEY Please note all offers are cash or hard money only (no mortgages cash offers only) Please note all offers are with zero contingencies (noRead more"
let removeString = "818 22nd St, West Palm Beach, FL 33407 2 bedrooms | "
let newString = string.replacingOccurrences(of: removString, with: "")
print(newString)
我可以想一想,你试图删除“|”之前的第一部分,但我不确定:)