From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ebb1ed7c8dc88b44 X-Google-Attributes: gid103376,public From: steved@pacifier.com (Steve Doiel) Subject: Re: string comparison? Date: 1997/10/17 Message-ID: <3446caa3.0@news.pacifier.com>#1/1 X-Deja-AN: 281095889 References: Newsgroups: comp.lang.ada Date: 1997-10-17T00:00:00+00:00 List-Id: In article , tram@mulholland.seas.ucla.edu says... > > > I am new to the ada programming language and I would appreciate it >if somebody could help me out with a couple of things. >1. Is there anyway to do a string comparison in ada? > So far, I have done it character by character but I am wondering if there > is a better way to do it? Sure, how about: DECLARE ucToken : String := "CONST"; BEGIN IF ucToken = "CONST" THEN DoSomething; END IF; END; >2. Is there anyway to exit out of a program inside an if-then-else statement? > I have a program that waits for a command, and depending on that command, > it would do something. So I thought that the quit command would be > simplest. But I can't even exit out of the if-then-else block. IF Ada.Characters.Handling.To_Upper( response ) = "QUIT" THEN RETURN; END IF; -- Since the main program in Ada is a procedure, you can RETURN to leave -- the main procedure. > >TIA. > >----------------------------------------------------------------- >Tri Tram, Computer Science and Engineering at UCLA >http://www.seas.ucla.edu/~tram