0

我已经创建了这段代码

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

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

4

3 回答 3

1

您只需要“ \”转义该“ stringWithFormat:”调用中的引号...

于 2013-04-10T04:39:11.037 回答
0
NSString *insertSQL = [NSString stringWithFormat:@"Update Expense_Group set Expense_sum = Expense_sum-'%@' where Expense_Type_Id = '%@'",strExpAmount,current_Expense_TypeId];
于 2013-04-10T05:05:53.697 回答
0
NSString *insertSQL = [NSString stringWithFormat:@"Update Expense_Group set Expense_sum = Expense_sum-%@ where Expense_Type_Id = %@",strExpAmount,current_Expense_TypeId];

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

于 2013-04-10T04:45:35.600 回答