Strings [ HP ALLBASE/BRW Reference Manual ] MPE/iX 5.0 Documentation
HP ALLBASE/BRW Reference Manual
Strings
A string is a series of characters enclosed in double quote marks, For
example:
"This is a string"
Strings can be up to 255 characters long.
String Operations
String operations are used to concatenate string values or to extract a
subset out of a string value. During a calculation, string length is
unlimited; however, you must specify a string length for the result of
the calculated item (maximum length 255 characters). Trailing blanks in
strings are ignored when they are used in string calculations. Trailing
blanks in constants are not ignored.
String Concatenations
String concatenations look like this example:
customer-name & " in " & city & "," & state
Where customer-name is Regular Oil Industries, city is Dallas and state
is Texas, the result is:
"Regular Oil Industries in Dallas, Texas"
Note that blank characters must be specified explicitly. (HP ALLBASE/BRW
ignores trailing blanks in string items.)
String Extraction Function
This function extracts a subset out of a string value, as shown in the
following three examples.
Example 1
SUBSTRING ("Whiskey", 2, 3)
In this example, "Whiskey" is the source string, 2 the position from
which the extraction starts, and 3 the length of the extracted string.
The result of the extraction is:
"his"
Example 2
SUBSTRING ("Whiskey", 10, 2)
In this example, "Whiskey" is the source string, 10 the position from
which the extraction starts, and 2 the length of the extracted string.
The result is that blanks are returned, as shown here:
" "
Blanks are returned if the start position is greater than the string
length.
Example 3
SUBSTRING ("Whiskey", -3, 4)
In this example, "Whiskey" is the source string, -3 the position from
which the extraction starts, and 4 the length of the extracted string.
The result is:
"Whis"
Note that if a position less than 1 is specified, position 1 is used.
Using double quote marks (") in Strings
You can use double quote marks in strings with HP ALLBASE/BRW version
A.00.10 and later. If you want to specify the string ABC"D, define a
string calculated item ABCD, with formula:
"ABC""D"
Then specify item ABCD when you want to print ABC"D. Using two double
quote marks in a string calculated item will print one set of double
quote marks.
MPE/iX 5.0 Documentation