comp.lang.ada
 help / color / mirror / Atom feed
From: steved@pacifier.com (Steve Doiel)
Subject: Re: string comparison?
Date: 1997/10/17
Date: 1997-10-17T00:00:00+00:00	[thread overview]
Message-ID: <3446caa3.0@news.pacifier.com> (raw)
In-Reply-To: EI5vIH.Et7@seas.ucla.edu


In article <EI5vIH.Et7@seas.ucla.edu>, 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





      parent reply	other threads:[~1997-10-17  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-10-16  0:00 string comparison? Tri Tram
1997-10-17  0:00 ` Tom Moran
1997-10-17  0:00 ` Steve Doiel [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox