comp.lang.ada
 help / color / mirror / Atom feed
From: Reinert Korsnes <Reinert.Korsnes@ffi.no>
Subject: Re: String manupulation
Date: Wed, 22 Aug 2001 10:15:30 +0200
Date: 2001-08-22T10:15:30+02:00	[thread overview]
Message-ID: <9lvq0p$cpm$1@snipp.uninett.no> (raw)
In-Reply-To: 9lu7r2$3vp$1@news.online-isp.com

Thanks to all of you.  Is this the (dirty ?) way to do it (?) :

-----------------------------------------------
with Text_IO,Ada.Strings,Ada.Strings.Fixed,Ada.Strings.Maps;
use  Text_IO,Ada.Strings,Ada.Strings.Fixed,Ada.Strings.Maps;
procedure Rtest1 is
   package Int_Io is new Text_IO.Integer_Io (Integer);
   use Int_Io;
   I,J : Integer := 1;
   FS : String := " This is a test to split a string ";
   C1 : String := "123456789012345678901234";
   Set : Character_Set := To_Set(" ");
begin
   Put(C1);New_Line;
   Put(FS);New_Line;
   while I < FS'Length loop
      Find_Token(FS(I..FS'Length),Set,Outside,I,J);
      Put(I);Put(J); Put(" ");Put(FS(I..J));New_Line;
      I := J+1;
   end loop;
end Rtest1;
-----------------------------------------------

Randy Brukardt wrote:

> Reinert Korsnes wrote in message <9lt2pe$lrm$1@snipp.uninett.no>...
>>Hi,
>>
>>I just wondered if there is a simple/direct way (in Ada) to split
>>a string with words (for example "abc    defg  2.56  hijklm")
>>into stings each containing one word ("abc", "defg", "2.56" and
> "hijklm") ?
> 
> Look at Ada.Strings.Fixed.Find_Token (see RM A.4.3(68):
> http://www.adaic.com/standards/95lrm/html/RM-A-4-3.html)
> 
> There are versions of this in Ada.Strings.Bounded and
> Ada.Strings.Unbounded as well.
> 
>                 Randy Brukardt.
> 
> 
> 
> 
> 

-- 
http://home.chello.no/~rkorsnes



  reply	other threads:[~2001-08-22  8:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-21  7:27 String manupulation Reinert Korsnes
2001-08-21 10:52 ` Georg Bauhaus
2001-08-21 12:52 ` David C. Hoos
2001-08-21 18:04 ` Randy Brukardt
2001-08-22  8:15   ` Reinert Korsnes [this message]
2001-08-22 15:53     ` Ted Dennison
2001-08-22 16:09       ` Ted Dennison
2001-08-22 16:23       ` David C. Hoos
2001-08-22 16:45         ` Ted Dennison
2001-08-23  8:21         ` Reinert Korsnes
2001-08-23 12:46           ` David C. Hoos
2001-08-22 16:39       ` Warren W. Gay VE3WWG
replies disabled

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