![]() |
|
#1
|
|||
|
|||
|
You have a string 64 chars long. You need to insert a character every 4 characters -- therefore, you need to add a total of 16 new characters.
What is the best way to do this? The only way I can think of is to use a case statement for position 4, 8, 12, and so on... Is there a better way? |
|
#2
|
|||
|
|||
|
Try:
Code:
var
i, c : Integer;
sBuffer : String;
begin
sBuffer := '0123456789012345678901234567890123456789012345678901234567890123';
c := 0;
for i:=Length(sBuffer) downto 2 do begin
Inc(c);
if c = 4 then begin
c := 0;
Insert('*',sBuffer,i);
end;
end;
Showmessage( sBuffer );
__________________
Regards, Abdulaziz Jasser |
![]() |
| Thread Tools | |
| Display Modes | |
|
|