code_junkie

In Delphi 7, how do I escape a percent sign (%) in the Format function?

Nov 12th, 2011
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. SQL.Text := Format('select foo from bar where baz like ''%s%''',[SearchTerm]);
  2.  
  3. SQL.Text := Format('select foo from bar where baz like ''%s''',[SearchTerm+'%']);
  4.  
  5. SQL.Text := Format('select foo from bar where baz like ''%s%%''',[SearchTerm]);
Add Comment
Please, Sign In to add comment