Re: Array of Strings

On Sep 13, 7:18 am, jedivaughn <jedivaugh...@xxxxxxxxx> wrote:
Hi everyone,

I'm having trouble making a array of type string. can some one show me
how to do this. I've tried type letters is array (Integer range <>) of
String; but I get error "unconstrained element type in array
declaration". what am I doing wrong?

One of the things that needs to be impressed upon newer Ada
programmers is that Ada's String type is *not* a varying-length
string. Some languages have varying-length strings built into them,
like BASIC and Perl; you can just assign a 2-character string into a
string variable, and later change it to an 80-character string, and
later to an empty (zero-length) string, and so on, without worrying
too much. (I believe there are many other languages that also have
this sort of string type.) Ada's String type is not like this. A
String variable has a particular length and that length cannot be
changed. (Maybe it was a mistake to name it "String" because of the
potential for confusion.)

Ludovic already mentioned Bounded_String and Unbounded_String which
were added in Ada 95 to fill that hole.

-- Adam


Relevant Pages

  • Help in French|Spanish|German translation.
    ... I am also an author of User-defined string functions. ... WORDTRANEX (cSearched, cArExpressionSought | cExpressionSough, ... each string of the array is searched ... If the parameter nArStartOccurrence is -1 or omitted, the replacement starts ...
  • Re: question about the new "dict" command
    ... dimensional associative array. ... string" and the string rep of a dict is a list. ... really a string in Tcl or most programming languages. ... of interpretation, ...
  • Re: passing a string to a dll
    ... Joe, I really appreciate you taking the time to demonstrate this. ... sure how I would implement indexing it for random alphanumeric codes. ... I might handle the array. ... I actually have been wondering if I could use a second string ...
  • Re: passing a string to a dll
    ... I might handle the array. ... I actually have been wondering if I could use a second string ... look at insertion cost, organization cost, and search cost. ...
  • RE: Structure conversion from C++ to VB-2008?
    ... One of the most important structures is AmiVar structure. ... point number, the array of floating point numbers, a string or IDispatch ... Dim 13012679 as Integer ...