Strings Delphi

Title: Converting a Integer to a 9 diget string (and back)
Question: For a SMS service it can be handy to have 2 seperate integer numbers as a internal referance to somthing. For ease of use a numer enterd by a user can be converted by using the 9 as a split char. These to functions let you convert integers to a nine diget string and back.
Answer:
function NineNumersToInteger(AString : String ) : Integer ;
var
i,StrLength : Integer ;
ZerosString : String ;
begin
result := 0 ;
ZerosString := '' ;
StrLength := length(AString);
for i := 1 to StrLength -1 do
ZerosString := ZerosString + '0' ;
for i := 1 to StrLength do
begin
if i StrLength then
result := result + ((StrToInt(AString[i]+ZerosString) * 9) div 10)
else result := result + StrToInt(AString[i]) ;
delete(ZerosString,1,1);
end;
end;
function IntegerToNineNumers(AInteger : Integer ) : String ;
var
i : Integer ;
begin
i := AInteger ;
i := (AInteger div 9) ;
i := (i * 10);
i := i + (AInteger mod 9) ;
result := IntToStr(i);
end;