[Spark2014-discuss] SPARK 2014 strings. Basic I/O

David MENTRÉ dmentre at linux-france.org
Tue Jul 1 22:04:34 CEST 2014


I would like to implement array of pre-defined strings in a SPARK 2014 
program (with GPL 2014 Ed.).

I plan to just print those strings on the standard output.

In the same way, I would like to read standard input to convert it to 
integers (probably using Yannick's code posted some time ago).

I've done some basic googling but there are several ways to define array 
of strings in Ada and I don't know what should be prefer between String, 
Bounded_String, Unbounded_String, ... (moreover my Ada knowledge is very 
very basic).

I tried:
    Str_Array : constant array(Positive range <>) of String(1..2) := ("A 
", "bb");

Moreover I don't know how to avoid filling smaller strings with spaces.

1. What is the preferred way (i.e. most easily provable) to define such 
array of strings in SPARK 2014 where strings can be a different size 
(but statically known at compile time)?

2. In the same way, what are recommended input/output procedures to use 
in a SPARK 2014 program?

3. What is the recommended type to use to define string variables in a 
SPARK 2014 program? "String(1..255)"?

Thank you!
Best regards,

PS: Following blog post simply uses the type "String". I'm not sure it 
is the easiest path though.

More information about the Spark2014-discuss mailing list