function TfrmLibrary.lpad(data, len: Integer; add: String):String;
var
    i: Integer;
    tmp: String;
begin
    tmp:=”;
    for i:=0 to len-Length(IntToStr(Data))-1 do
        tmp:=tmp+add;
    Result:=tmp+IntToStr(Data);
end;

Look code above…if you can post like this, it’s easy way to show your code a like language syntax. Download here the syntaxhighlighter plugin. Just copy the plugin to /wp-content/plugins/ then in your admin area, choose plugins menu [...]