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,4f316de357ae35e9 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-08-02 17:30:37 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newsfeed.news2me.com!west.cox.net!cox.net!p01!news2.central.cox.net.POSTED!53ab2750!not-for-mail Message-ID: <3D4B2382.7030209@telepath.com> From: Ted Dennison User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.0) Gecko/20020530 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: FAQ and string functions References: <20020730093206.A8550@videoproject.kiev.ua> <4519e058.0207300548.15eeb65c@posting.google.com> <20020731104643.C1083@videoproject.kiev.ua> <4519e058.0208010629.5e6182ca@posting.google.com> <20020801194720.Q1080@videoproject.kiev.ua> <4519e058.0208020605.5ab7e092@posting.google.com> <3D4AAF63.72782659@san.rr.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 03 Aug 2002 00:30:36 GMT NNTP-Posting-Host: 68.12.51.201 X-Complaints-To: abuse@cox.net X-Trace: news2.central.cox.net 1028334636 68.12.51.201 (Fri, 02 Aug 2002 20:30:36 EDT) NNTP-Posting-Date: Fri, 02 Aug 2002 20:30:36 EDT Organization: Cox Communications Xref: archiver1.google.com comp.lang.ada:27630 Date: 2002-08-03T00:30:36+00:00 List-Id: Darren New wrote: > Ted Dennison wrote: > >>I understand it, your problem isn't with splitting and joining, its >>with figuring out where to do the splitting and joining. Correct? > > > More like his problem is not having ubiquitous variable-sized arrays so you > could write a function that does the splitting and returns the result as an > array. That's the sort of thing that makes Perl quicker to put together than But we *do*, with Ada.Strings.Unbounded. However, you generally don't need to work with variable-sized arrays. I really don't see what the problem with fixed array slicing is. I'll agree that there is probably some room for improvement with Ada's string libraries. But slicing and joining are there just fine right now. It looks like what he is talking about would be something like the following: (in Ada.Strings.Unbounded) type String_Pair is array (Left..Right) of Unbounded_String; function Split (Around : String; Source : Unbounded_String) return String_Pair; The issue *can't* be just that Ada doesn't have this one routine, because there are an infinite number of possible string handling routines that Ada (and Perl) doesn't have. The issue has to be that "common task XYZ is unreasonably tough in Ada due to lack of support". I don't see that case proven yet (but it could be). The example task to use this for was (I believe) parsing an entire file into tokens around a given separator string. The above "Split" doesn't do that, its just part of an idiom for doing that which some Perl users might be accostomed to using. I don't think the whole task would be significantly tougher (or slower) if you were to use Ada.Strings.Index in your solution than it would be if you were to use our theoretical Ada.Strings.Unbounded.Split as the workhorse. And I *have* written such routines before. It doesn't always happen, but I've been known to learn from the experience. :-)