未知的转义序列'\ x20'

时间:2013-04-10 04:37:19

标签: ios sql-server ios4

我已创建此代码

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

现在,我收到此警告“未知转义序列'\ x20'”。

3 个答案:

答案 0 :(得分:1)

您只需要“\”在“stringWithFormat:”通话中转义引号...

答案 1 :(得分:0)

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

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

答案 2 :(得分:0)

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