I have a list that I want to print:
foo: list of string;
I want to create a string bar
that is the concatenation of the elements of foo
. In Perl I would do:
$bar = join " ", @foo;
The only way I can think of to do this in specman is:
var bar: string = "";
for each in foo {
bar = appendf("%s %s", bar, it);
};
This seems like it would have very poor performance, because it copies bar
onto itself for each element in foo
. Is there any better way to do this?