Delphi QuotedStr函数-给字符串两边加单引号并返回.
Quoted 英文意思:引用、转引
函数原型:
function QuotedStr(const S: string): string; var I: Integer; begin Result := S; for I := Length(Result) downto 1 do if Result[I] = '''' then Insert('''', Result, I); Result := '''' + Result + ''''; end;
函数作用:给字符串两边加单引号并返回.
例如 (SQL语句):
//ss 字符串 'select * from AA where Str1='''+ ss +''' ' ; //等同于: 'select * from AA where Str1='+ QuotedStr(ss)+' ' ;
创建时间:2020.04.22 更新时间:2020.04.22