Section 8.5 - Unbounded_String Basics

The Unbounded_String type is defined in the package Ada.Strings.Unbounded, so you'll need to ``with'' package Ada.Strings.Unbounded to use the Unbounded_String type. Package Ada.Strings.Unbounded also provides a number of useful basic operations on Unbounded_String. The Ada RM section A.4.5 provides a complete definition of package Ada.Strings.Unbounded.

Here are a few important operations:

Comparison operations (such as "=" and "<") are defined in this package. There are other routines to modify or search Unbounded_Strings, including "&" (concatenate two Unbounded_Strings together), Translate, Trim, Head, Tail, Index, and Find_Token.

You can use assignment (:=) as well to assign one value to another. Unlike type String, the lengths of the Unbounded_String's need not be equal.


Quiz:

Given a variable ``Input'' of type Unbounded_String, what expression would return the value of the fourth character in Input?

  1. Element(Input, 4)
  2. Replace_Element(Input, 4, 'L')
  3. Element(4, Input)

You may also:

PREVIOUS Go back to the previous section

NEXT     Skip to the next section

OUTLINE  Go up to lesson 8 outline

David A. Wheeler (dwheeler@dwheeler.com)

The master copy of this file is at "http://www.adahome.com/Tutorials/Lovelace/s8s5.htm".