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,2f2ae3c6286f407b,start X-Google-Attributes: gid103376,public From: "Tom Hargraves" Subject: Re: Tokenizing a string in Ada Date: 2000/11/03 Message-ID: <3a030814@rsl2.rslnet.net>#1/1 X-Deja-AN: 689320529 References: <20001103063537.25697.00000237@ng-mf1.news.cs.com> <8tuk98$c7k$1@nnrp1.deja.com> X-Original-NNTP-Posting-Host: 204.244.117.45 X-Trace: 3 Nov 2000 10:46:44 -0800, 204.244.117.45 X-MSMail-Priority: Normal X-Priority: 3 Newsgroups: comp.lang.ada X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Date: 2000-11-03T00:00:00+00:00 List-Id: Hi Ted, This post is more akin to Franck's post 'binary tree and files', but since you are promoting 'open token' I thought I'd post this here. [NB. I have not had time to study Open Token, so maybe my answers are there] Many many many times I have seen Ada (and other) programmers saving data structures in files, the more astute save them in human readable form, unless there is a pressing performance hit. I have seen just as many different ways to save this data, from a variety of tags, indenture, tuples etc. Is there not some standard way of doing this? If there isn't should there be? Is XML a standard we should choose? Seems to provide nesting, a flexible tag schema, and freely available format checkers. Are there any easy to use ada packages available to facilitate this? Yours curiously, Tom H. "Ted Dennison" wrote in message news:8tuk98$c7k$1@nnrp1.deja.com... > In article <20001103063537.25697.00000237@ng-mf1.news.cs.com>, > rbbaldwin8@cs.com (Rbbaldwin8) wrote: > > > I need to read lines from a text file which consist of a mixture of > > strings and numeric values separated by commas and use these values in > > the application. The format of each line is the same as far as which > > data is in each position. I think the safest way to do this is to read > > each line into a fixed-length string, then split it at the commas. > > Strings in the CSV lines are not quoted but do not contain commas > > within the strings. > > How can I do this in Ada. I can't find a string function like C's > > strtok or TCL's split, or am I misssing something. > > Check out the Ada.Strings.* packages. In particular, look at > Ada.Strings.Fixed.Index and Ada.Strings.Fixed.Find_Token. While you are > at it read entirely through LRM annexes A, L, and K. If you don't have > an LRM, you can borrow ours at > http://www.ada-auth.org/~acats/arm-html/RM-TOC.html :-). There's lots of > goodies in there that every Ada programmer need to know about. > > If you are going to have to do this kind of thing a lot, you may want to > look into OpenToken ( > http://www.telepath.com/dennison/Ted/OpenToken/OpenToken.html ). I use > it to tokenize at least 3 different kinds of .csv files, along with a > couple other configuration files on the project I'm working on now. It > alreay has a predefined token type for CSV "strings" (as you call them). > > > -- > T.E.D. > > http://www.telepath.com/~dennison/Ted/TED.html > > > Sent via Deja.com http://www.deja.com/ > Before you buy.