Вверх ↑
Ответов: 1304
Рейтинг: 405
#1: 2015-10-13 20:25:17 ЛС | профиль | цитата
Netspirit, если смирится с потерей скорости кодогенератора то так работает
#pas
function StringToCode(const s:string):string;
var i:integer; intostr:bool;
begin
//if Length(s) > 254 then begin
// Result := 'PChar(LoadResData(''' + cgt.resAddStr(PChar(s)) + '''))';
// exit;
//end;
Result := 'PChar(';
intostr := false;
for i := 1 to Length(s) do
if ord(s[i])<32 then begin
if intostr then Result := Result + '''';
Result := Result + '#' + Int2Str(ord(s[i]));
intostr := false;
end else begin
if not intostr then Result := Result + '''';
if s[i]='''' then Result := Result + '''';
Result := Result + s[i];
intostr := true;
end;
if intostr then Result := Result + '''';
Result := Result + '#0)';
end;
хотя это конечно не решение
карма: 3

0