Double quote a string that has spaces
...
uses
System.SysUtils...
...
var
...
temp_str: String;
begin
...
{ double quote a string that has spaces }
if StrScan(PChar(temp_str), Chr($20)) <> nil then
temp_str := AnsiQuotedStr(temp_str, Chr($22));
...
$20
is the the space character; $22
is the
double-quote character.
I know that QuoteSpacedString in the Code Snippets Databasedoes the same thing. The above if statement may be faster for strings that
can only have $20
as a white space character such as a file path.
Tested on RAD Studio XE3.
Author: | Don Rowlett |
---|---|
Contributor: | Don Rowlett |
Added: | 2013-07-30 |
Last updated: | 2013-07-30 |