📅  最后修改于: 2022-03-11 15:00:48.839000             🧑  作者: Mango
{ URLEncode Encodes string to be suitable as an URL. (ie. replaces for example a space with %20) Example: myencodeURL:=URLEncode(myURL);}function URLEncode(s: string): string;var i: integer; source: PAnsiChar;begin result := ''; source := pansichar(s); for i := 1 to length(source) do if not (source in ['A'..'Z', 'a'..'z', '0'..'9', '-', '_', '~', '.', ':', '/']) then result := result + '%' + inttohex(ord(source), 2) else result := result + source;end;