Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!mailrus!ncar!umigw!mthvax!mathrich From: mathrich@mthvax.cs.miami.edu (Rich Winkel) Newsgroups: comp.lang.pascal Subject: Re: CASE for Strings? (MS-Dos TP) Message-ID: <1990Apr14.015005.5655@mthvax.cs.miami.edu> Date: 14 Apr 90 01:50:05 GMT References: <8001@hydra.gatech.EDU> Organization: U of Miami Dept. of Math. and Computer Science, Coral Gables, FL 33124 Lines: 19 In <8001@hydra.gatech.EDU> ce1zzes@prism.gatech.EDU (Eric Sheppard) writes: >I wish to perform functions according to commands parsed into a string array. >The CASE operator only works for simple variable types. Is there an elegant way >to perform the CASE for complex (string) variables? Desired sample construct: >case Command of > '1STCOM' : FirstCommand; > '2NDCOM' : SecondCommand; > . > . >end; case ((pos(' '+Command+' ',' 1STCOM 2NDCOM QUIT 3RDCOM ...')-1) DIV 7) of 0: firstcommand; 1: secondcommand; or something similar. Not elegant, but usable. Rich