Autor Beitrag
cherry
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 136

WinXP - Professional
RAD Studio 2009
BeitragVerfasst: Di 12.07.05 10:46 
Hallo du..
ich bräuchte kurz mal die Funktion die mir sagen kann ob das angegebene Zeichen
ein Nummerischen Wert ist oder nicht. ??

so in der Art:

ausblenden Delphi-Quelltext
1:
2:
if ISTZAHL(MidStr(String1, 1, 1)) then
 ShowMessage('Juhui das erste Zeichen im String String1 ist eine Zahl!')


??

THX

cherry tree :shock:

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Di 12.07.05 10:51 
ausblenden Delphi-Quelltext
1:
2:
if Ord(DeinChar) in ['0'..'9'] then
...
Alstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: Di 12.07.05 10:53 
Etwas ungewöhnliche Lösung, aber funzt (hoffe ich mal):

ausblenden Delphi-Quelltext
1:
2:
3:
4:
  if ((Byte(MidStr(String1, 1, 1)) > 47) and ((Byte(MidStr(String1, 1, 1)) < 58) then
    // ist eine Zahl
  else
   // keine Zahl


Alstar
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Di 12.07.05 10:53 
oder nach deinem Beispiel:
ausblenden Delphi-Quelltext
1:
 if string1[1] in ['0'..'9'] then ...					
cherry Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 136

WinXP - Professional
RAD Studio 2009
BeitragVerfasst: Di 12.07.05 10:55 
Titel: 1000 dank
:D Genau das habe isch gemeint.

Dakder