WebFormUrlDecode Function

Action

Decodes encoded strings included in URLs. See WebFormUrlEncode for more details about the encoding format.

Include file

WebAPI.bdh

Syntax

WebFormUrlDecode( inout sString: string ): boolean;

Return value

  • true if the string could be decoded

  • false otherwise

Parameter Description
sString String variable to decode
Note: The input string is overwritten and replaced by the shorter or equal-sized decoded string.

Example

dcltrans
  transaction TWebFormUrlDecode
  var
    sPlain, sUrl : string;
    nUrlLen      : number;
  begin
    sPlain := "http://www.testurl.com/demo[1]()";
    write("plain: "); write(sPlain); writeln;
    nUrlLen := sizeof(sUrl);
    WebFormUrlEncode(sUrl, nUrlLen, sPlain);
    write("encoded: "); write(sUrl); writeln;
    WebFormUrlDecode(sUrl);
    write("decoded: "); write(sUrl); writeln;
  end TWebFormUrlDecode;

Output

plain: http://www.testurl.com/demo[1]()
encoded:
http%3A//www.testurl.com/demo%5B1%5D%28%29
decoded: http://www.testurl.com/demo[1]()