// 例如:addressFn('河南省郑州市郑州东站'),输出结果为'郑州'
let addressFn= function (t){
let address = t
let end
let fn = function (v){
address = address.substring(address.indexOf('省')+1, end)
return address.indexOf(v)>0 ? address.indexOf(v) : address.length
}
let arr = ['市','站', '东', '西', '南', '北']
arr.forEach(v => end = fn(v))
return address
}
字符串去除一些关键字
最新推荐文章于 2024-08-05 02:52:03 发布