Strings are specified by sequences of printable ASCII characters surrounded with double quotes. The string color set is large unless restricted by the
with ... and clause, in which case it is small.
colset name = string [with string-exp1..string-exp2 [and int-exp1..int-exp2]];
lexicographic (with the ASCII ordering)
Restricts the character set of string color sets. The character set is specified by the string expressions
Each string expression must evaluate to a string of length 1, and it must be the case that
Restricts the length of string color sets. The minimum and maximum length of the string is specified by the integer expressions
int-exp2. It must be the case that
colset S = string;
A string color set is used in the example CP-net Simple Protocol.
colset LowerString = with “a”..”z”;
var lowerString : LowerString;
The CPN variable
lowerString may contain only the lowercase letters a,b,…,z . For example, and
owercas are legal values, but
Lowercase letter and
b34 are not.
colset SmallString = with “a”..”d” and 3..9
var smallString : SmallString;
The CPN variable
smallString may contain only the letters
d. Its length must be >=3 and <=9. For example,
bbacdab are legal values, but
bcde are not.
s1^s2: concatenate the strings
String.size s: number of characters in
substring (s,i,len): extract a substring of length len starting at position
s, first position is
explode s: convert string
sto list of chars
implode l: convert list
lof chars to a string
See also color set functions.
For additional details and functions see the STRING signature in the SML Basis Library Manual.
You must be logged in to post a comment.