Standard URL encode function?

后端 未结 13 1846
轻奢々
轻奢々 2020-11-30 05:33

Is there a Delphi equivalent of this .net\'s method:

Url.UrlEncode()

Note
I haven\'t worked with Delphi for several years now. As I

13条回答
  •  抹茶落季
    2020-11-30 06:02

    Another simple way of doing this is to use the HTTPEncode function in the HTTPApp unit - very roughly

    Uses 
      HTTPApp;
    
    function URLEncode(const s : string) : string;
    begin
      result := HTTPEncode(s);
    end
    

    HTTPEncode is deprecated in Delphi 10.3 - 'Use TNetEncoding.URL.Decode'

    Uses
      NetEncoding;
    
    function URLEncode(const s : string) : string;
    begin
      result := TNetEncoding.URL.Encode(s);
    end
    

提交回复
热议问题