comp.lang.ada
 help / color / mirror / Atom feed
* Unconstrained String Handling.
@ 1997-07-03  0:00 RC
  1997-07-03  0:00 ` Anonymous
  1997-07-10  0:00 ` Matthew Heaney
  0 siblings, 2 replies; 4+ messages in thread
From: RC @ 1997-07-03  0:00 UTC (permalink / raw)




Is there a portable way to handle data elements of type: string?

(Any attributes which can be accessed for instance.)

As for constant strings:

    line1:                      constant string := "Some text.";


begin
    put_line (line1);
    put_line (line1'last);

....



procedure string_op (ip_text: IN STRING) is
begin
    ?????




Thanks,

RC1




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Unconstrained String Handling.
  1997-07-03  0:00 Unconstrained String Handling RC
@ 1997-07-03  0:00 ` Anonymous
  1997-07-10  0:00 ` Matthew Heaney
  1 sibling, 0 replies; 4+ messages in thread
From: Anonymous @ 1997-07-03  0:00 UTC (permalink / raw)



On Thu, 3 Jul 1997 13:21:33 +0100, RC <rc1@clanchy.demon.co.uk> wrote:

> 
> Is there a portable way to handle data elements of type: string?
> 
> (Any attributes which can be accessed for instance.)
> 
> As for constant strings:
> 
>     line1:                      constant string := "Some text.";
> 
> 
> begin
>     put_line (line1);
>     put_line (line1'last);
> 
> ....
> 
> 
> 
> procedure string_op (ip_text: IN STRING) is
> begin
>     ?????
> 
> 
> 
> 
> Thanks,
> 
> RC1
> 
> 

Type String is simply a one-dimensional array type, its declaration is

type String is array(Positive range <>) of Character;

from ARM 3.6.3(4), so all attributes of array types are defined for
String.

Jeff Carter  PGP:1024/440FBE21
My real e-mail address: ( carter @ innocon . com )
"Now go away, or I shall taunt you a second time."
Monty Python & the Holy Grail

Posted with Spam Hater - see
http://www.compulink.co.uk/~net-services/spam/

















^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Unconstrained String Handling.
  1997-07-03  0:00 Unconstrained String Handling RC
  1997-07-03  0:00 ` Anonymous
@ 1997-07-10  0:00 ` Matthew Heaney
  1997-07-11  0:00   ` Anonymous
  1 sibling, 1 reply; 4+ messages in thread
From: Matthew Heaney @ 1997-07-10  0:00 UTC (permalink / raw)



In article <NMFtgKANl5uzYwNP@clanchy.demon.co.uk>, RC
<rc1@clanchy.demon.co.uk> wrote:

>Is there a portable way to handle data elements of type: string?
>
>(Any attributes which can be accessed for instance.)
>
>As for constant strings:
>
>    line1:                      constant string := "Some text.";
>
>
>begin
>    put_line (line1);
>    put_line (line1'last);
>
>....
>
>
>
>procedure string_op (ip_text: IN STRING) is
>begin
>    ?????

ip_text'First yields the index position of the first element of the actual
parameter.

ip_text'Last yields the last index position of the string.

ip_text'Range is shorthand for ip_text'First .. ip_text'Last.

ip_text'Length yields the length of the actual argument; it's the same
value as ip_text'last - ip_first + 1.

What are you trying to do, exactly?

--------------------------------------------------------------------
Matthew Heaney
Software Development Consultant
<mailto:matthew_heaney@acm.org>
(818) 985-1271




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Unconstrained String Handling.
  1997-07-10  0:00 ` Matthew Heaney
@ 1997-07-11  0:00   ` Anonymous
  0 siblings, 0 replies; 4+ messages in thread
From: Anonymous @ 1997-07-11  0:00 UTC (permalink / raw)



<NMFtgKANl5uzYwNP@clanchy.demon.co.uk>

On Thu, 10 Jul 1997 23:25:03 -0800, mheaney@ni.net (Matthew Heaney)
wrote:
..
> ip_text'Length yields the length of the actual argument; it's the same
> value as ip_text'last - ip_first + 1.
..

Unless the string has length zero, in which case Ip_Text'Last <
Ip_Text'First.

Jeff Carter  PGP:1024/440FBE21
My real e-mail address: ( carter @ innocon . com )
"Now go away, or I shall taunt you a second time."
Monty Python & the Holy Grail

Posted with Spam Hater - see
http://www.compulink.co.uk/~net-services/spam/




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1997-07-11  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-07-03  0:00 Unconstrained String Handling RC
1997-07-03  0:00 ` Anonymous
1997-07-10  0:00 ` Matthew Heaney
1997-07-11  0:00   ` Anonymous

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