草庐IT

txtfSearch

全部标签

ios 在构建字符串时我需要重用相同的占位符

这个问题在这里已经有了答案:Isthereawaytospecifyargumentposition/indexinNSStringstringWithFormat?(3个答案)关闭9年前。我正在制作一个在SQL语句中使用的字符串。我需要在其中多次重复使用相同的字符串。此字符串是来自文本框的文本。当前代码:NSString*searchStr=[NSStringstringWithFormat:@"(NameLIKE\'%%%@%%\'ORContactLIKE\'%%%@%%\')",[self.txtfSearchtext],[self.txtfSearchtext]];所有%都用