3分钟
字符串转为数组
字符串使用split()函数转为数组:
txt="a,b,c,d,e" // String
txt.split(","); // 使用逗号分隔
txt.split(" "); // 使用空格分隔
txt.split("|"); // 使用竖线分隔 字符串使用split()函数转为数组:
txt="a,b,c,d,e" // String
txt.split(","); // 使用逗号分隔
txt.split(" "); // 使用空格分隔
txt.split("|"); // 使用竖线分隔 Copyright © 2013-2025 Tencent Cloud.All Rights Reserved. 腾讯云 版权所有
学员评价