Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私が文字列を持っていると仮定します:
str = “ab,cd,ef”
それをリストに分割したい
lst = [“ab”,”cd”,ef”]
文字列に含まれるアイテムの数が事前にわからないと仮定して、どうすれば最善を尽くすことができますか?
基本的に私はPerlと同等のスペックマンを探しています:
$str = "ab,cd,ef"; @lst = split /,/, $str;
str_splitはあなたが望むものです。
Specman 6.1ドキュメントから:
str_split(str: string, regular-exp: string): list of string
構文例
var s: list of string = str_split("first-second-third", "-");