String colour sets | CPN Tools help |
CPN ML |
with ... and
clause, in which case it is small.
colset name = string [with string-exp1..string-exp2 [and int-exp1..int-exp2]];
with
Clausestring-exp1
and string-exp2
.
Each string expression must evaluate to a string of length 1, and it must be the case that string-exp1
<=string-exp2
.
and
Clauseint-exp1
and int-exp2
. It must be the case that 0<=int-exp1<=int-exp2
.
colset S = string;
A string colour 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, "ab" and "lowercase" are legal values, but "Lowercase letters" and "ab345" are not.
colset SmallString = with "a".."d" and 3..9
var smallString : SmallString;
The CPN variable smallString
may contain only the letters a,b,c and d. Its length must be >=3 and <=9. For example, "abcd" and "bbacdab" are legal values, but "ab" and "bcde" are not.
s1^s2 |
concatenate the strings s1 and s2 |
String.size s |
number of characters in s |
substring (s,i,len) |
extract a substring of length len starting at position i in s, first position is 0 |
explode s |
convert string s to list of chars |
implode l |
convert list l of chars to a string |
See also colour set functions.
For additional details and functions see the STRING signature in the SML Basis Library Manual.