Function FormataNome(const Nome: String): String; var
x : Integer;
lista : Array[0..4] ofString[03];
NomeL : string; function NaoAchaPreposicao(Palavra : String): Boolean; var
x : Integer; begin
Result := True; for x := 0 to 4 do if Trim(Palavra) = lista[x] then
Result := False; end;
function ToLower(Text: String): String; var
Ind: Integer;
const
LW = 'áâãàéêíóôõúüûçñ';
UP = 'ÁÂÃÀÉÊÍÓÔÕÚÜÛÇÑ'; begin
Result := ''; for Ind := 1 to Length(Text) do if Pos(Copy(Text, Ind, 1), UP) > 0 then
Result := Result + Copy(LW, Pos(Copy(Text, Ind, 1), UP), 1) else
Result := Result + LowerCase(Copy(Text, Ind, 1)); end; begin
Result := UpCase(Result[1]) + Copy(Result, 2, Length(Result));
for x := 2 to Length(NomeL) dobegin if NomeL[x] = #32 then if Copy(NomeL,x+1,1) <> 'e' then if NaoAchaPreposicao(Copy(NomeL,x+1,3)) then
Result := Copy(Result, 1, x)
+ UpCase(Result[x+1])
+ Copy(Result, x+2, Length(Result)); end; end;