I want to open a registry key in the format XXX'XX from Delphi XE2
Rootpath := '\SOFTWARE\XXXX XXXX\XXXXX''XXX\XXX';
Reg.OpenKey(Rootpath, FALSE);
Since Delphi escape character for ' is '' I cannot able to open the registry.
Looking for your help. Thanks in Advance.
Escaping the single quote with ''
in a string works perfectly well. The resulting string contains a single character. That's the whole point of escaping it. To convince yourself of this try writing such a string to the console, or showing it in a message box.
{$APPTYPE CONSOLE}
begin
Writeln('XXX''XXX');
end.
This program outputs:
XXX'XXX
The reality is that your problem is elsewhere. Possible reasons include: