aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authork-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-06-14 23:06:47 +0000
committerk-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-06-14 23:06:47 +0000
commitf01995d31ad202ccbbe8f79213303e479923cd81 (patch)
treefc2764e1b9bec9393b8a17246f7aed6f613797a8
parent68b29a08bc21b15b923b3430fbc41baedba73883 (diff)
downloadusdx-f01995d31ad202ccbbe8f79213303e479923cd81.tar.gz
usdx-f01995d31ad202ccbbe8f79213303e479923cd81.tar.xz
usdx-f01995d31ad202ccbbe8f79213303e479923cd81.zip
code improvement: conversion of case statements to boolean assignments
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1149 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--Game/Code/Classes/UCommon.pas41
1 files changed, 11 insertions, 30 deletions
diff --git a/Game/Code/Classes/UCommon.pas b/Game/Code/Classes/UCommon.pas
index 4465a397..fe3ea6a4 100644
--- a/Game/Code/Classes/UCommon.pas
+++ b/Game/Code/Classes/UCommon.pas
@@ -660,27 +660,19 @@ end;
function IsAlphaChar(ch: WideChar): boolean;
begin
// TODO: add chars > 255 when unicode-fonts work?
- case ch of
- 'A'..'Z', // A-Z
- 'a'..'z', // a-z
- #170,#181,#186,
- #192..#214,
- #216..#246,
- #248..#255:
- Result := true;
- else
- Result := false;
- end;
+ Result := ch in
+ ['A'..'Z', // A-Z
+ 'a'..'z', // a-z
+ #170, #181, #186,
+ #192..#214,
+ #216..#246,
+ #248..#255
+ ];
end;
function IsNumericChar(ch: WideChar): boolean;
begin
- case ch of
- '0'..'9':
- Result := true;
- else
- Result := false;
- end;
+ Result := ch in ['0'..'9'];
end;
function IsAlphaNumericChar(ch: WideChar): boolean;
@@ -691,23 +683,12 @@ end;
function IsPunctuationChar(ch: WideChar): boolean;
begin
// TODO: add chars outside of Latin1 basic (0..127)?
- case ch of
- ' '..'/',':'..'@','['..'`','{'..'~':
- Result := true;
- else
- Result := false;
- end;
+ Result := ch in [ ' '..'/', ':'..'@', '['..'`', '{'..'~' ];
end;
function IsControlChar(ch: WideChar): boolean;
begin
- case ch of
- #0..#31,
- #127..#159:
- Result := true;
- else
- Result := false;
- end;
+ Result := ch in [ #0..#31, #127..#159 ];
end;
(*