![]() |
Prüfen auf Sonderzeichen? [Gelöst]
Hallo. Folgendes : Ich wollt n eigenen Code machen der mir alles auf Sonderzeichen prüft.
So
Delphi-Quellcode:
var
i, i2: Integer; sAll, sName: String; Only: Boolean; begin sAll := 'abcdefghijklmnopqrstuvwxyz1234567890'; sName := txtName.Text; Result := False; Only := True; For i := 0 to Length(sName) do begin If Only = False then begin Result := False; Exit; end; For i2 := 0 to Length(sAll) do begin Only := False; If LowerCase(sName[i]) = sAll[i2] then begin Only := True; Break; end; end; end; Result := True; Nur funktioniert das überhaupt nicht. Was mach ich da falsch :gruebel: [EDIT]Habs raus[/EDIT] |
Re: Prüfen auf Sonderzeichen? [Gelöst]
Hai Gerrit89,
hier auch mal ein Ansatz von mir ;-)
Delphi-Quellcode:
function Sonderzeichen (const Value : String) : Boolean;
var ndx : Integer; foo : Boolean; aText : String; begin aText := LowerCase (Value); ndx := 1; foo := False; while (ndx <= Length (aText)) AND not (foo) do begin if not (aText[ndx] IN ['0'..'9','a'..'z']) then begin foo := True; end; Inc (ndx); end; result := foo; end; procedure TForm1.Button1Click(Sender: TObject); begin if (Sonderzeichen(Edit1.Text)) then begin ShowMessage ('blubb'); end; end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 09:50 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz