Dart String.split(Pattern pattern)
方法在指定分隔符的匹配处拆分字符串并返回子字符串列表。
语法
split(Pattern pattern)
参数
pattern
- 代表分隔符。
返回值
- 返回String对象的列表。
示例
void main() {
String str1 = "Welcome, to, xuhuhu.com";
print("New String: ${str1.split(',')}");
}
执行上面示例代码,得到以下结果 -
New String: [Welcome, to, xuhuhu.com]