Personal tools
You are here: Home Documentation Users Guide 7. Handing String Data Symbols 7.1 STRING VARIABLES
Document Actions

7.1 STRING VARIABLES

String variables are defined using DEFINE VARIABLE (or its alias LET). They can be read from and written to netCDF files. Arrays of strings may be defined and a limited number of algebraic operations are defined for string variables. They can be passed to go scripts and functions. Grave accents around a scalar string return the string.

yes? LET astring = "hello everyone"
yes? LIST/NOHEAD astring
"hello everyone"
yes? message `astring`
!-> message hello everyone
hello everyone
Hit Carriage Return to continue


7.1.1 String arrays

Strings in arrays may be of variable length. The syntax {"a","b","c"} denotes an array of strings. Two commas in a row denotes a null (missing value) string. Single and double quoted strings are both allowed, but must match for an individual string, e.g. 'P" is not valid.

Examples: the following define and list valid string arrays:

yes? LET a =  {"s1","s2", ,"s3"}

yes? LIST a
{"s1","s2", ,"s3"}
1 / 1:"s1"
2 / 2:"s2"
3 / 3:""
4 / 4:"s3"

yes? LET b = {, 'string1','s2',,'cccc'}
yes? LIST/i=3:5 b
{, 'string1','s2',,'cccc'}
3 / 3:"s2"
4 / 4:""
5 / 5:"cccc"

yes? LET c = {'p', 'q', 'a longer string'}
yes? LIST/NOHEAD/ORDER=x c
"p" "q" "a longer string"

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: