我有一些代码可以过滤变量中的数字。
代码如下:
Coalesce(
case
when IsNull( NetRate_Quote_Insur_Quote_Locat.[Transaction], '' ) <> '' and
NetRate_Quote_Insur_Quote_Locat.EndorsementNumber = NetRate_Quote_Insur_Quote.EndorsementNumber
then
case NetRate_Quote_Insur_Quote_Locat.[Transaction]
when 'ADD' then 'Add'
when 'DELETED' then 'Delete'
when 'CHANGED' then 'Change'
when 'New Quote' then 'Add'
end,
case
when tblQuotes.OriginalQuoteGuid is NULL or NetRate_Quote_Insur_Quote.TypeofBusiness = 'Reinstate'
then 'Add'
when tblQuotes.QuoteStatusID = 12 then 'Delete'
else 'No Change'
end ) as TransactionName
在swift 3中,此代码正常工作。但是在Swift 5中,我遇到了一个错误var numbers = String(anotherNumbers.characters.filter { "01234567890.".characters.contains($0) })
如何解决此错误? 谢谢。
答案 0 :(得分:1)
您可以删除字符以直接使用String。
例如
var anotherNumbers = "0123456789"
var numbers = String(anotherNumbers.filter { "01234567890.".contains($0) })
返回“ 0123456789”