Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- aHasCharsToEncode := False;
- for i := 1 to Length(s) do begin
- c := s[i];
- if (c = '%') or (c < ' ') then begin
- aHasCharsToEncode := True;
- break;
- end;
- end;
- if not aHasCharsToEncode then begin
- Result := s;
- exit;
- end;
- sb.Init;
- for i := 1 to Length(s) do begin
- c := s[i];
- if (c = '%') or (c < ' ') then begin
- sb.Add('%' + IntToHex(Ord(c), 2));
- end
- else begin
- sb.Add(c);
- end;
- end;
- Result := sb.Value;
Add Comment
Please, Sign In to add comment