Reputation: 127638
Supposing I have a string:
str = “ab,cd,ef”
and I want to split it into a list
lst = [“ab”,”cd”,ef”]
How can I do it best, assuming that I don’t know ahead of time how many items are in the string?
Basically I'm looking for a specman equivalent to Perl's:
$str = "ab,cd,ef";
@lst = split /,/, $str;
Upvotes: 1
Views: 785
Reputation: 24270
str_split is what you want.
From Specman 6.1 docs:
str_split(str: string, regular-exp: string): list of string
Syntax Example
var s: list of string = str_split("first-second-third", "-");
Upvotes: 2