zoukankan      html  css  js  c++  java
  • c#语言-Split拆分



    static void Main(string[] args) { int[,] cj = new int[3,4]; Console.WriteLine("学号 语文 数学 外语"); for (int i = 0; i < 3; i++) { Console.Write(i + 1); Console.Write(" "); string s = Console.ReadLine(); string[] str = s.Split(' ',' ',',');/////Split(' ','',''......)或Split(','),Split(' ')等等很多种都可以达到同样的目的。
    目的就是将字符串拆分成n串;
    int yw = Convert.ToInt32(str[0]); int sx = Convert.ToInt32(str[1]); int wy = Convert.ToInt32(str[2]); Console.WriteLine(yw + sx + wy); } // string s = Console.ReadLine(); //int yw, sx, wy; //string[] str = s.Split(' ',',','-',' '); //yw = Convert.ToInt32(str[0]); //sx = Convert.ToInt32(str[1]); //wy = Convert.ToInt32(str[2]); //Console.WriteLine("语文:{0},数学:{1},外语:{2}", yw, sx, wy); }
  • 相关阅读:
    Vue3.0
    Vue
    Vue
    Vue3.0
    Vue
    Vue
    Vue
    Vue
    Vue3.0
    万字长文|十大基本排序,一次搞定!
  • 原文地址:https://www.cnblogs.com/koker/p/5425462.html
Copyright © 2011-2022 走看看