将一个以逗号分隔的字符串转化为一个数组

爱被打了一巴掌 2022-12-06 15:19 325阅读 0赞
  1. public class Test02 {
  2. public static void main(String[] args) {
  3. String orgStr="about,bed,check,doc,txt,from";
  4. String [] result = orgStr.split(",");
  5. for(int a = 0;a<result.length;a++){
  6. System.out.print(result[a]+"\t");
  7. }
  8. }
  9. }

发表评论

表情:
评论列表 (有 0 条评论,325人围观)

还没有评论,来说两句吧...

相关阅读