«« Site Rescued »»

While the site is still going to move from its current host, a new site will now take its place. More Info.

The new site may have less content, but the core will now remain. And it will now play nicely with phones! Keep an eye on the DelphiDabbler Blog for news.

» Help

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

« Return to contents »