Вообще-то в шаблоне приложения к госакту уже есть функция приведения адреса регистрации к "удобоваримому" виду:
Код:
function FormatAU(AUValue:String):String;
var st,st2:String;
begin
if AUValue=''
then begin
Result:='';
Exit;
end;
st:=StringPart(AUValue,1,',');
if st<>'804'
then begin
Result:=SEF(st,'KDS.txt')+', ';
end
else Result:='';
if SEF(StringPart(AUValue,5,','),'OblCenters.txt')<>'+'
then begin
st:=StringPart(AUValue,3,',');
if (st='Автономна республіка Крим') or (st='АР Крим')
//or (st='Кримське ханство')
then Result:=Result+st+', '
else Result:=Result+st+' область, ';
end;
if SEF(StringPart(AUValue,5,','),'RayCenters.txt')<>'+'
then Result:=Result+StringPart(AUValue,4,',')+' район, ';
Result:=Result+StringPart(AUValue,5,',');
st:=StringPart(AUValue,6,',');
if st<>'-'
then Result:=Result+', '+st;
st:=StringPart(AUValue,7,',');
if st<>'-'
then Result:=Result+', буд. '+st;
st:=StringPart(AUValue,8,',');
if st<>'-'
then Result:=Result+', корп. '+st;
st:=StringPart(AUValue,9,',');
if st<>'-'
then Result:=Result+', кв. '+st;
end;
Текст функции поместите в скрипт шаблона перед главным begin...end
В качестве аргумента функции используйте параметр AU.
Пример:
var AUComfort:String;
....
function FormatAU(AUValue:String):String;
....
//главный begin...end
begin
....
AUComfort:=FormatAU(Param('AU'));
....
end;