[TRUCO DELPHI] Convertir el primer caracter de un Edit a Mayuscula
delphi
with Sender as TEdit do if (SelStart = 0) or (Text[SelStart] = ' ') then if Key in ['a'..'z'] then Key := UpCase(Key);
Saludos!
Escrito 28 noviembre 2016 - 02:35
[TRUCO DELPHI] Convertir el primer caracter de un Edit a Mayuscula
with Sender as TEdit do if (SelStart = 0) or (Text[SelStart] = ' ') then if Key in ['a'..'z'] then Key := UpCase(Key);
Saludos!
Escrito 28 noviembre 2016 - 02:44
Segunda Version
procedure TForm1.Button1Click(Sender: TObject); var GetString : string; GetLength : Integer; I : Integer; T : String; begin if edit1.SelLength > 0 then GetString:= Edit1.Seltext else GetString:= Edit1.Text; GetLength:= Length(Edit1.Text); if GetLength>0 then begin for I:= 0 to GetLength do begin if (GetString[I] = ' ') or (I=0) then begin if GetString[I+1] in ['a'..'z'] then begin T:=GetString[I+1]; T:=UpperCase(T); GetString[I+1]:=T[1]; end; end; end; if edit1.Sellength>0 then Edit1.Seltext:=GetString else Edit1.Text:=GetString; end; end;