تستطيع تحويل String الى set of
وبعدها تستعمل في Case
كود :
case Integer of
0: (Lo, Hi: Cardinal);
1: (Cardinals: array [0..1] of Cardinal);
2: (Words: array [0..3] of Word);
3: (Bytes: array [0..7] of Byte);
كود :
function HexChar(c: Char): Byte;
begin
case c of
'0'..'9': Result := Byte(c) - Byte('0');
'a'..'f': Result := (Byte(c) - Byte('a')) + 10;
'A'..'F': Result := (Byte(c) - Byte('A')) + 10;
else
InvalidGUID;
Result := 0;
end;
end;
كود :
function ConvertEraString(const Count: Integer) : string;
var
FormatStr: string;
SystemTime: TSystemTime;
Buffer: array[Byte] of Char;
P: PChar;
begin
Result := '';
with SystemTime do
begin
wYear := Year;
wMonth := Month;
wDay := Day;
end;
FormatStr := 'gg';
if GetDateFormat(GetThreadLocale, DATE_USE_ALT_CALENDAR, @SystemTime,
PChar(FormatStr), Buffer, SizeOf(Buffer)) <> 0 then
begin
Result := Buffer;
if Count = 1 then
begin
case SysLocale.PriLangID of
LANG_JAPANESE:
Result := Copy(Result, 1, CharToBytelen(Result, 1));
LANG_CHINESE:
if (SysLocale.SubLangID = SUBLANG_CHINESE_TRADITIONAL)
and (ByteToCharLen(Result, Length(Result)) = 4) then
begin
P := Buffer + CharToByteIndex(Result, 3) - 1;
SetString(Result, P, CharToByteLen(P, 2));
end;
end;
end;
end;
end;
كود :
if not ScanNumber(S, Pos, N3, L3) then Exit;
case DateOrder of
doMDY: begin Y := N3; YearLen := L3; M := N1; D := N2; end;
doDMY: begin Y := N3; YearLen := L3; M := N2; D := N1; end;
doYMD: begin Y := N1; YearLen := L1; M := N2; D := N3; end;
end;
كود :
case LocaleType of
LOCALE_SHORTDATE:
LFormat := GetDateTimeFormat(Locale, kCFDateFormatterShortStyle, kCFDateFormatterNoStyle);
LOCALE_LONGDATE:
LFormat := GetDateTimeFormat(Locale, kCFDateFormatterFullStyle, kCFDateFormatterNoStyle);
LOCALE_SHORTTIME:
LFormat := GetDateTimeFormat(Locale, kCFDateFormatterNoStyle, kCFDateFormatterShortStyle);
LOCALE_LONGTIME:
LFormat := GetDateTimeFormat(Locale, kCFDateFormatterNoStyle, kCFDateFormatterMediumStyle);
else
LFormat := '';
end;
كود :
function MapFault(Context: Psigcontext_t): TRuntimeError;
begin
case Context^.trapno of
TRAP_OVERFLOW:
Result := System.reIntOverflow;
TRAP_BOUND:
Result := System.reRangeError;
TRAP_INVINSTR:
Result := System.rePrivInstruction; // This doesn't seem right, but we don't
// have an external exception to match!
TRAP_STACKFAULT:
Result := System.reStackOverflow;
TRAP_SEGMENTNP,
TRAP_GPFAULT:
Result := System.reAccessViolation;
TRAP_PAGEFAULT:
Result := System.reAccessViolation;
else
Result := System.reAccessViolation;
end;
end;
وهناك الكثير في SysUtils.pas