Guest User

Untitled

a guest
Jan 20th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. "C:Program Files (x86)PostgreSQL9.0binpsql.exe" -h localhost -p 5432 -d myDB -U myadmin -f "C:UsersuserAppDataRoamingff.sql"
  2.  
  3. function GetNextHex(InStr:String;var Position:Integer):String;
  4. var
  5. NextHex: Integer;
  6. begin
  7. NextHex := PosEx('%', InStr, Position);
  8. if (NextHex > -1) then
  9. Result := Copy(InStr, NextHex, 3)
  10. else
  11. Result := '';
  12. Position := NextHex;
  13. end;
  14.  
  15. function PercentHexToInt(Hex: String):Integer;
  16. var
  17. str : string;
  18. begin
  19. if (Hex[1] <> '%') then Result := 0
  20. else
  21. begin
  22. // Result := strtoint(StrToHex('$' + Copy(Hex, 1,2)));
  23. str :=StringReplace(HEx,'%','',[rfReplaceAll,rfIgnoreCase]);
  24. str:=trim(str);
  25. Result := StrToInt(('$' +str));
  26. end;
  27. end;
  28.  
  29. function ReplaceHexValues(Str: String):String;
  30. var
  31. Position:Integer;
  32. HexValue:String;
  33. IntValue:Integer;
  34. CharValue:String;
  35. begin
  36. Position := 0;
  37. while(Position > -1)
  38. begin
  39. HexValue := GetNextHex(Str, Position);
  40. IntValue := PercentHexToInt(HexValue);
  41. CharValue := Char(IntValue);
  42. if (CharValue = #0) then break;
  43. //Note that Position Currently contains the the start of the hex value in the string
  44. Delete(Str, Position, 3);
  45. Insert(CharValue,Str,Position);
  46. end;
  47. Result:=Str;
  48. end;
Add Comment
Please, Sign In to add comment