Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


next up previous contents index
Next: Records Up: Values, Types, and Constants Previous: Numeric Types

Subsections


Strings

The string type holds character-string values, used to represent and manipulate text.


String Constants

You create string constants by enclosing text within either single (') or double (") quotes.

Glish treats text within single quotes as a single string value; these constants are scalars. For example,

    'hello there'
yields a string value of one element. That element has 11 characters.

Glish breaks up text within double quotes into words at each block of whitespace (blanks, tabs, or newlines). The whitespace is removed from the result. Thus

    "hello there"
yields a two-element string value. The first element is the character string hello and the second element the string there. Leading and trailing whitespace is ignored, so
    " hello     there "
is equivalent to
    "hello there"

In both kinds of string constants, a backslash character (\) introduces an escape sequence. Except for the standard escape sequences (see Table 4.2, page [*]), any other character following a backslash, ``\'', is passed along literally. For example,

    "hello \"there\" how \
     are\nyou?"
yields the string
    hello "there" how are you?
whose length is 5 (recall that the \n newline is treated as whitespace and removed from the string), while
    'hello \'there\' how \
     are\nyou?'
yields the single-element string
    hello 'there' how are
    you?

String Operators

There are a number of options available for manipulating strings:


next up previous contents index
Next: Records Up: Values, Types, and Constants Previous: Numeric Types   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-10-15