[hampi-devel] New language operation: sub-string

9 views
Skip to first unread message

Shay Artzi

unread,
May 21, 2010, 4:53:08 PM5/21/10
to hampi...@googlegroups.com
Hi all-
I just committed an update to Hampi that allows the definition and use
of sub-strings.
Here are a couple of examples of how to use the new operation:

var v:5;
val vSub := v[2:3]; //substring of v (offset 2, length 3)
assert v contains "fred";
assert vSub contains "de";
//expected result "frede"

var v:5;
val prefix := v[0:3];
val suffix := v[2:3];
reg r1 := star(['a'-'b']);
reg r2 := star("b");
assert prefix in r1;
assert suffix in r2;
//expected result "aabbb"


Thanks,
Shay




Reply all
Reply to author
Forward
0 new messages