我已经创建了这段代码
NSString *insertSQL = [NSString stringWithFormat:@"Update Expense_Group set Expense_sum = Expense_sum-\%@\ where Expense_Type_Id = \"%@\"",strExpAmount,current_Expense_TypeId];
现在,我收到了这个警告“未知转义序列'\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];
这可以解决 %@ 之前不需要转义序列的问题。