Re: Array slices and types



"Maciej Sobczak" <see.my.homepage@xxxxxxxxx> wrote in message
news:5886ab95-8744-4b72-b911-e4cb8889c7e7@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Consider this:

type Name is new String (1 .. 10);

N : Name;

Some_String : String := "abc";

How can I assign Some_String to the beginning slice (ie. to the first
three characters) of N?
Everything that I can think of (short of copying characters
individually) hits the type compatibility problem.

If you can change the definition of Name to:

subtype Name is String( 1 .. 10 );

Then of course you can use:

N( 1 .. 3 ) := Some_String( 1 .. 3 );

But that doesn't sound like what you're looking for.

Regards,
Steve


--
Maciej Sobczak * www.msobczak.com * www.inspirel.com

Database Access Library for Ada: www.inspirel.com/soci-ada


.



Relevant Pages