From f01995d31ad202ccbbe8f79213303e479923cd81 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sat, 14 Jun 2008 23:06:47 +0000 Subject: 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 --- Game/Code/Classes/UCommon.pas | 41 +++++++++++------------------------------ 1 file changed, 11 insertions(+), 30 deletions(-) (limited to 'Game/Code') 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; (* -- cgit v1.2.3