comp.lang.ada
 help / color / mirror / Atom feed
From: scallassig@mailexpire.com (Harald Korneliussen)
Subject: Re: Simple library functions
Date: 13 Feb 2004 04:54:11 -0800
Date: 2004-02-13T04:54:11-08:00	[thread overview]
Message-ID: <19401efb.0402130454.2779b091@posting.google.com> (raw)
In-Reply-To: 19401efb.0402122318.68154453@posting.google.com

scallassig@mailexpire.com (Harald Korneliussen) wrote in message news:<19401efb.0402122318.68154453@posting.google.com>...
> Jeffrey Carter <spam@spam.com> wrote in message news:<kdVWb.1821
> 
> > 
> > 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?



  reply	other threads:[~2004-02-13 12:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-12 19:37 Simple library functions Harald Korneliussen
2004-02-12 19:50 ` Ed Falis
2004-02-12 19:54 ` Ed Falis
2004-02-12 20:54 ` Ludovic Brenta
2004-02-13  0:52 ` Jeffrey Carter
2004-02-13  7:18   ` Harald Korneliussen
2004-02-13 12:54     ` Harald Korneliussen [this message]
2004-02-13 21:36       ` Randy Brukardt
2004-02-13 21:55     ` Pascal Obry
2004-02-14 16:14       ` Harald Korneliussen
2004-02-13  1:21 ` Stephen Leake
replies disabled

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