1
假如我有一個字符串:將字符串分割成一個列表中的Specman
str = 「ab,cd,ef」
,我想將它分割成一個列表
lst = [「ab」,」cd」,ef」]
我怎樣才能做到這一點最好的,假設我事先不知道該字符串中有多少物品?
基本上我正在尋找的Specman相當於Perl的一個:
$str = "ab,cd,ef";
@lst = split /,/, $str;
假如我有一個字符串:將字符串分割成一個列表中的Specman
str = 「ab,cd,ef」
,我想將它分割成一個列表
lst = [「ab」,」cd」,ef」]
我怎樣才能做到這一點最好的,假設我事先不知道該字符串中有多少物品?
基本上我正在尋找的Specman相當於Perl的一個:
$str = "ab,cd,ef";
@lst = split /,/, $str;
str_split是你想要的。
從6.1的Specman文檔:
str_split(str: string, regular-exp: string): list of string
語法示例
var s: list of string = str_split("first-second-third", "-");