In Below code I am using ShellExecute(), I need to pass a URL into it but the two GET param of URL like RangeFromDate and RangeToDate values should be in Double quotes.
I need to escape the double quotes. I am using "/ RangeFromDate "/ but its not working.
The above web page doesn’t seem to be working at the moment (even http://example.com/ isn’t working right now), but I think the string being displayed in the @fxshrat’s interpretation window is exactly what @Neil81 was asking for.
Some additional information about “backslash for escaping”:
It is not really the case. You do NOT need to escape % in normal string. You only need to escape % in the first argument of StrFormat()/printf(), because there and only there % is treated as field formatting sequence. But in normal string, it is not.
You were having wrong impression because you have used this:
printf( url ); // first arg is a formatting sequence, % has special meaning
And then first parameter is used as formatting sequence.
But if you used:
printf( "%s", url ); // here url is NOT 1st arg and % does not have special meaning
You would not need to do anything with % signs in the url. Note: %s sequence used above is supported only in versions 6.17 or higher.
So all you really need to do is this:
RangeFromDate = "2015-01-02";
RangeToDate = "2017-02-03";
// proper web URL begins with http(s)://
url = "http://example.com?datefrom=%22" +
RangeFromDate +
"%22&rangeto=%22" +
RangeToDate +
"%22";
printf( "%s", url ); // for debugging only (can be removed)
ShellExecute( url, "", "" ); // don't need to specify browser if http is used