Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Galera a função é a seguinte:
function PMAIUSCULA(texto: string): String;
var tam,i:integer;
aux,s:string;
c:char;
begin
texto:=AnsiLowerCase(texto);
aux:='';
for i:=1 to length(texto) do
begin
if i=1 then
begin
aux:=Copy(AnsiUpperCase(texto*),i,1);*
aux:=aux+texto[i+1];
end
else
* if texto** = ' ' then*
aux:=aux+Copy(AnsiUpperCase(texto[i+1]),1,1)
else
aux:=aux+texto[i+1]
end;
//texto:='';
i:= 2;
tam:= length(aux);
while i <= length(aux) do
begin
S:= '';
s:= copy(aux,i,3);
if (s = 'Do ') or (s = 'Da ') or (s = 'De ') then
begin
s:= Copy(LowerCase(aux),i,1);
aux:= Copy(aux,1,i-1)+S+Copy(aux,i+1,(tam-i));
end
else
if (s = 'Dos') or (s = 'Das') then
begin
s:= Copy(LowerCase(aux),i,1);
aux:= Copy(aux,1,i-1)+S+Copy(aux,i+1,(tam-i));
end;
i:=i+1;
end;
Result:=AUX;
end;
Ficou prontinha... converte nomes próprios, nomes de cidades, etc..... alguma sugesão, avisem-me!!!!
Abraços a toda a comunidade....!
Carregando comentários...