未知的转义序列'x20'



我已经创建了这个代码

NSString *insertSQL = [NSString stringWithFormat:@"Update Expense_Group set Expense_sum = Expense_sum-%@ where Expense_Type_Id = "%@"",strExpAmount,current_Expense_TypeId];

,现在,我得到了这个警告"未知转义序列'x20'"。

您只需要" "转义" stringWithFormat: "调用中的引号…

NSString *insertSQL = [NSString stringWithFormat:@"Update Expense_Group set Expense_sum = Expense_sum-%@ where Expense_Type_Id = %@",strExpAmount,current_Expense_TypeId];

这可以解决%@前不需要转义序列的问题。

NSString *insertSQL = [NSString stringWithFormat:@"Update Expense_Group set Expense_sum = Expense_sum-'%@' where Expense_Type_Id = '%@'",strExpAmount,current_Expense_TypeId];

最新更新