next up previous contents index
Next: Accessing eigenvalue results Up: [B/D] operands and operators Previous: Data functions

String-handling functions

 

Detecting null strings
 


tex2html_wrap_inline33790 tex2html_wrap_inline33790 Usage

tex2html_wrap_inline33806 tex2html_wrap_inline33806

This is a boolean operator which returns the value unity if tex2html_wrap_inline43990 is an empty string (or if tex2html_wrap_inline43990 is not a string), and zero if it is a string with positive length.  

Comparing strings for equality
 
tex2html_wrap_inline33790 tex2html_wrap_inline33790 Usage

  • eq$  operator; two arguments tex2html_wrap_inline43998 and tex2html_wrap_inline34392 in parenthesis and separated by a comma. tex2html_wrap_inline43998 and tex2html_wrap_inline34392 are the names of strings or sequences of alphanumeric characters.

tex2html_wrap_inline33806 tex2html_wrap_inline33806

By default, S1 and S2 are assumed to be the names of defined strings. If either string is not recognised, then the name supplied given is used instead. This is a boolean operator which returns the value unity if the string\ tex2html_wrap_inline43998 is equal to the string tex2html_wrap_inline34392 , and zero otherwise. The complementary operator is neq$ . For example, suppose that we have defined only the strings a=mustard and b=cress. Then:

  • tex2html_wrap_inline44010 is equal to zero, as the strings `mustard' and `cress' are not equal;
  • tex2html_wrap_inline44012 is equal to one, as a is taken to be the string `mustard' and `mustard' is not a string, and therefore taken to mean itself.
 

String length
 
tex2html_wrap_inline33790 tex2html_wrap_inline33790 Usage

  • len$  operator; one argument tex2html_wrap_inline43990 in parenthesis. tex2html_wrap_inline43990 is the name of a string or a sequence of alphanumeric characters.

tex2html_wrap_inline33806 tex2html_wrap_inline33806

This returns the length of the string tex2html_wrap_inline43990 as a non-negative integer. If the string has not been defined, then the length of the alphanumeric sequence supplied as the name of the string is returned.

If the string has been defined, but is empty, the length is defined to be zero.  

Comparing strings for inequality
 
tex2html_wrap_inline33790 tex2html_wrap_inline33790 Usage

  • neq$  operator; two arguments tex2html_wrap_inline43998 and tex2html_wrap_inline34392 in parenthesis and separated by a comma. tex2html_wrap_inline43998 and tex2html_wrap_inline34392 are the names of strings or sequences of alphanumeric characters.

tex2html_wrap_inline33806 tex2html_wrap_inline33806

By default, S1 and S2 are assumed to be the names of defined strings. If either string is not recognised, then the name supplied given is used instead. This is a boolean operator which returns the value zero if the string\ tex2html_wrap_inline43998 is equal to the string tex2html_wrap_inline34392 , and unity otherwise. The complementary operator is eq$ . For example, suppose that we have defined only the strings a=mustard and b=cress. Then:

  • tex2html_wrap_inline44032 is equal to one, as the strings `mustard' and `cress' are not equal;
  • tex2html_wrap_inline44034 is equal to zero, as a is taken to be the string `mustard' and `mustard' is not a string, and therefore taken to mean itself. Consequently these two are equal, and the operator returns a value indicating false.
 

Detecting numeric strings
 
tex2html_wrap_inline33790 tex2html_wrap_inline33790 Usage

  • real$  operator; one argument tex2html_wrap_inline43990 in parenthesis. tex2html_wrap_inline43990 is the name of a string or a sequence of alphanumeric characters.

tex2html_wrap_inline33806 tex2html_wrap_inline33806

If the name S supplied has not been defined as a string, then the name itself is used as the string. This is an operator which returns the integer value zero, one or two depending upon the form of the string\ tex2html_wrap_inline43990 :

1
is returned if tex2html_wrap_inline43990 is of the form d.d, optionally preceded by a minus sign;
2
is returned if tex2html_wrap_inline43990 is of the form d, optionally preceded by a minus sign;
0
is returned if neither of the above applies.

where d represents at least one digit. Note in particular that the decimal point must be both preceded and succeeded by at least one digit if this operator is to return a value of unity. For example, tex2html_wrap_inline44046 and tex2html_wrap_inline44048 .  


next up previous contents index
Next: Accessing eigenvalue results Up: [B/D] operands and operators Previous: Data functions

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