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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fff7eeabc7a7bc9c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-22 01:20:42 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!128.39.3.168!uninett.no!not-for-mail From: Reinert Korsnes Newsgroups: comp.lang.ada Subject: Re: String manupulation Date: Wed, 22 Aug 2001 10:15:30 +0200 Organization: UNINETT news service Message-ID: <9lvq0p$cpm$1@snipp.uninett.no> References: <9lt2pe$lrm$1@snipp.uninett.no> <9lu7r2$3vp$1@news.online-isp.com> NNTP-Posting-Host: sthrkou.ffi.no Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: snipp.uninett.no 998468441 13110 193.156.99.159 (22 Aug 2001 08:20:41 GMT) X-Complaints-To: news-abuse@uninett.no User-Agent: KNode/0.4 Xref: archiver1.google.com comp.lang.ada:12207 Date: 2001-08-22T10:15:30+02:00 List-Id: 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