Re: Spaces
From: AlanGLLoyd (alanglloyd_at_aol.com)
Date: 11/19/04
- Next message: Alan Mead: "KeyDown bug (or my ignorance?)"
- Previous message: AlanGLLoyd: "Re: Newbie question about TMemo"
- In reply to: Richard Hutchinson: "Spaces"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 19 Nov 2004 21:30:23 GMT
In article <d9GdnZ5zMt3VkgPcRVnyvg@pipex.net>, "Richard Hutchinson"
<richard.hutchinson@dsl.pipex.com> writes:
>menufile[chk]:=temp+Spaces(12-(length(temp)));
> for pos:=1 to 15 do
> begin
> pack:=pack+menufile[pos];
> end;
>
Or ...
Pack := '';
for i := 1 to 15 do
Pack := Format('%s%.12s', [Pack, MenuFile[i] + StringOfChar(' ', 12)]);
Or somewhat quicker (if you're worried about speed) ...
Pack := StringOfChar(' ', 12 * 15);
for i := 0 to 14 do
for j := 1 to Length(MenuFile[i]) do
Pack[(i * 15) + j] := MenuFile[i + 1][j]; // transfer each MenuFile[i]
character into Pack at intervals of 12 characters.
You'll find things a bit easier and clearer if your arrays had a zero starting
index. But strings, of course start at [1]
Alan Lloyd
alanglloyd@aol.com
- Next message: Alan Mead: "KeyDown bug (or my ignorance?)"
- Previous message: AlanGLLoyd: "Re: Newbie question about TMemo"
- In reply to: Richard Hutchinson: "Spaces"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|