31
Programmers corner / \n
« on: February 04, 2010, 10:01:44 PM »
Result of a laborious work
{.dec to char|#65#66#13#10#67#68.} return 'AB'+CRLF+'CD'
AB
CD
{.replace|\-|{.dec to char|#45#13#10.}|\n|{.dec to char|#13#10.}|\t|{.dec to char|#09.}|The result\nof a labo\-rious work\tis often\nrewarded.}
The result
of a labo-
rious work is often
rewarded
the 'DEC TO CHAR' macro works only with a consequentive succession of chap #xxx ( xxx : value from 0 to 255)
Quote
end; // dir
function dectochar(s:string):string;
var
j:integer;
tab: TStringDynArray;
begin
try
result:='';
tab:=split('#',s);
for j := 0 to length(tab) - 1 do
if tab[j]>'' then
result:=result+chr(lo(strtoint(tab[j])));
except end;
end;
procedure handleSymbol();
........
if pars.Count < 1 then exit; // from here, only macros with parameters
if name = 'dec to char' then
result:=dectochar(p);
if name = 'dir' then
dir();
........
result:=xtpl(result, [
// '\n', CRLF, <<<------- don't forget to coment this line
'%build-time%', floatToStrF((now()-buildTime)*SECONDS, ffFixed, 7,3)
]);
{.dec to char|#65#66#13#10#67#68.} return 'AB'+CRLF+'CD'
AB
CD
{.replace|\-|{.dec to char|#45#13#10.}|\n|{.dec to char|#13#10.}|\t|{.dec to char|#09.}|The result\nof a labo\-rious work\tis often\nrewarded.}
The result
of a labo-
rious work is often
rewarded
the 'DEC TO CHAR' macro works only with a consequentive succession of chap #xxx ( xxx : value from 0 to 255)