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,a13657a6f67ac494 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-02-13 04:54:11 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: scallassig@mailexpire.com (Harald Korneliussen) Newsgroups: comp.lang.ada Subject: Re: Simple library functions Date: 13 Feb 2004 04:54:11 -0800 Organization: http://groups.google.com Message-ID: <19401efb.0402130454.2779b091@posting.google.com> References: <19401efb.0402121137.2a20b681@posting.google.com> <19401efb.0402122318.68154453@posting.google.com> NNTP-Posting-Host: 158.38.142.187 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1076676851 941 127.0.0.1 (13 Feb 2004 12:54:11 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 13 Feb 2004 12:54:11 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:5524 Date: 2004-02-13T04:54:11-08:00 List-Id: scallassig@mailexpire.com (Harald Korneliussen) wrote in message news:<19401efb.0402122318.68154453@posting.google.com>... > Jeffrey Carter wrote in message news: > > > > There's no function for that in the standard library because it's part > > of the language. Others have pointed out the 'Value attribute. > > Oops, you're right of course. I found it right after I posted, in a > tutorial. I couln't find it in the RM however, but then again I looked > at strings and integers only, not attributes. > > > I have no idea what String.split does in Java, but I suspect it's > > similar to Ada.Strings.(Fixed | Bounded | Unbounded).Find_Token. If not, > > you could look at www.adapower.com or www.adahome.com for Open_Token. > > String.split works like this: > > String s = "hi he ha ho" > > String strings[] = s.split(); > > // strings[] is now {"hi", "he", "ha", "ho"} > > In java it takes a regexp, with " \t\n" as default. My function takes > a set of characters (from Ada.Characters.Maps), with the set of > whitespace as default. > > I'll be right back.... Apropos that: when I looked at gnat's regexp package I saw a comment about certain functions being evaluated twice, once to determine the size and another time to actually produce the results. Have I understood correctly that in for instance s : String := function_returning_a_string_of_variable_length(junk : Integer); the function is actually evaluated twice? (Stupid question of me to ask, really, but I don't have an Ada compiler at school). Would it do that in java too?