Code: Alles auswählen
  var UTF8Key: TUTF8Char;
    WC:Word;
begin
  UTF8Key := 'Ӝ';
//  UTF8Key := 'a';
  WC:=Word(UTF8Decode(UTF8Key)[1]);
  case WC of 32..255:
    ShowMessage('Gotcha!');
  else
    ShowMessage('Nope...');
  end; Code: Alles auswählen
  var UTF8Key: TUTF8Char;
    WC:Word;
begin
  UTF8Key := 'Ӝ';
//  UTF8Key := 'a';
  WC:=Word(UTF8Decode(UTF8Key)[1]);
  case WC of 32..255:
    ShowMessage('Gotcha!');
  else
    ShowMessage('Nope...');
  end; Code: Alles auswählen
procedure TfrmMain.Button1Click(Sender: TObject);
var Str: string;
begin
  Str := 'abc';
  case Str of 'a'..'c':
    ShowMessage('Gotcha!');
  else
    ShowMessage('Nope...');
  end;
end; Code: Alles auswählen
  case Str of 'a':Code: Alles auswählen
  Str := 'linux';
  case Str of 'lin'..'lix':
    ShowMessage('Gotcha!');
  else
    ShowMessage('Nope...');
  end; Und im letzten Falle also:paweld hat geschrieben: So 6. Okt 2024, 13:36 However, ranges are allowed, and are the equivalent of anIn Ihrem Fall sieht es also so aus:Code: Alles auswählen
if (value>=beginrange) and (value<=endrange) then begin end;Code: Alles auswählen
var UTF8Key: TUTF8Char; begin UTF8Key := 'Ӝ'; //#211#156 case UTF8Key of #32..#255: // if (UTF8Key >= #32) and (UTF8Key <= #255) then ShowMessage('Gotcha!'); else ShowMessage('Nope...'); end; end;
Code: Alles auswählen
  if (Str >= 'lin') and (Str <= 'lix') thenCode: Alles auswählen
Str := 'linux';
  case Str of 'lin'..'lix':
    ShowMessage('Gotcha!');
  else
    ShowMessage('Nope...');
  end; Code: Alles auswählen
string              >  linux: #108 #105 #110 #117 #120
Beginn des Bereichs >  lin:   #108 #105 #110
Ende des Bereichs   >  lix:   #108 #105 #120Code: Alles auswählen
string              >  lizux: #108 #105 #122 #117 #120
 Verein
Verein Links
Links Suche
Suche