next up previous contents index
Next: Using strings Up: Strings Previous: Strings

Defining strings

 


tex2html_wrap_inline33790 tex2html_wrap_inline33790 Syntax

BD>string : S=N tex2html_wrap_inline33712

where S is the name of a string, and N is the string.

tex2html_wrap_inline33806 tex2html_wrap_inline33806

Strings are sequences of alphanumeric characters of a length varying between zero and currently 253 characters. It is possible to define strings having length zero, which we term empty strings. Strings are mostly used (1) to define quantities that might take different values for different parts of a [B/D] program; (2) as shorthand for some long sequence of characters. Some example definitions are

BD>string : a=xvariable1 tex2html_wrap_inline33712

BD>string : b2=intercept tex2html_wrap_inline33712

Commonly, command lines have leading and trailing spaces removed, and then other spaces (except the space separating command from arguments) are ignored and remaining characters converted to lower case. However, the STRING:  command is an exception: space and case conversions carried out only as necessary. This allows the definition part to be used for titles, further commands, and so forth, where the retention of case or spacing might be crucial: when the string is actually used, parsing will be carried out in the usual way.

The names of strings are subjected to space and case conversions, so that the two string names `TEXT1' and `text1' are equivalent. Substrings (see below) are, however, parsed completely. A string defined with the same name as a pre-existing string simply overwrites the former definition. String definitions can be checked by issuing the LOOK:  command with argument s . (When you do this, notice that a good deal of [B/D] output has names printed with the first character capitalised - this is cosmetic only.)

 



David Wooff
Wed Oct 21 15:14:31 BST 1998