diff --git "a/\345\274\240\346\236\227\347\272\242/Split.sln" "b/\345\274\240\346\236\227\347\272\242/Split.sln" new file mode 100644 index 0000000000000000000000000000000000000000..7f81a1cd23fabd29c04fe8c2f39f00e9dd31e06a --- /dev/null +++ "b/\345\274\240\346\236\227\347\272\242/Split.sln" @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30128.74 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Split", "Split\Split.csproj", "{7EF0B346-8E2F-4BCA-891D-CC696EBEF8F1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7EF0B346-8E2F-4BCA-891D-CC696EBEF8F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7EF0B346-8E2F-4BCA-891D-CC696EBEF8F1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7EF0B346-8E2F-4BCA-891D-CC696EBEF8F1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7EF0B346-8E2F-4BCA-891D-CC696EBEF8F1}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B52651A9-8C15-4E1C-B0FA-B0A35857CEB0} + EndGlobalSection +EndGlobal diff --git "a/\345\274\240\346\236\227\347\272\242/Split/Array.cs" "b/\345\274\240\346\236\227\347\272\242/Split/Array.cs" new file mode 100644 index 0000000000000000000000000000000000000000..19df798d66fede78f6386f63fdbe11cd1f42d81f --- /dev/null +++ "b/\345\274\240\346\236\227\347\272\242/Split/Array.cs" @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Text; + +namespace Split +{ + static class Array + { + public static void ArrayInfo(this string[,] arr) + { + for (int i = 0; i < arr.GetLength(0); i++) + { + for (int j = 0; j < arr.GetLength(1); j++) + { + Console.Write(arr[i,j]+" "); + } + } + } + + + + } +} diff --git "a/\345\274\240\346\236\227\347\272\242/Split/Program.cs" "b/\345\274\240\346\236\227\347\272\242/Split/Program.cs" new file mode 100644 index 0000000000000000000000000000000000000000..890967ec16709e63365e8d32e6f0307256df4120 --- /dev/null +++ "b/\345\274\240\346\236\227\347\272\242/Split/Program.cs" @@ -0,0 +1,88 @@ +using System; +using System.Drawing; +using System.Linq; + +namespace Split +{ + class Program + { + static void Main(string[] args) + { + //int[] intArr0 = new int[3]; + + int[] intArr1 = + { + 10, + 9, + 8, + }; + int[] intArr2 = new int[3] + { + 10, + 9, + 8 + }; + //二维 + string[,] arr = { { "1", "1" }, { "1", "2" }, { "1", "3" } }; + for (int i = 0; i < arr.GetLength(0); i++)//GetLength(维度)能获取多维数组 + { + for (int j = 0; j < arr.GetLength(1); j++) + { + Console.Write(arr[i, j] + " "); + } + } + Console.WriteLine(); + + arr.ArrayInfo(); + + + //锯齿形 + //int[][] a = new int[3][]; + //a[0] = new int[] { 1, 2 }; + //a[1] = new int[] { 3, 4, 5 }; + //a[2] = new int[] { 6, 7, 8, 9 }; + //for (int n = 0; n < a.Length; n++) + //{ + // Console.WriteLine("输出数组中第" + (n + 1)+"行是"); + // for (int m = 0; m < a[n].Length; n++) + // { + // Console.Write(a[n][m] + " "); + // } + // Console.WriteLine(); + + + + + + //foreach + int[] intArr ={ + 101, + 201, + 301 + }; + foreach(int into in intArr) + { + Console.WriteLine(into); + } + + + int[] point = { 1, 2, 3, 4, 5, 6 }; + int sum = 0; + foreach(int po in point) + { + sum = sum + po; + } + Console.WriteLine(sum); + + + string str = "闪闪发光的 , 宝贝"; + var strArr=str.Split('闪'); + string[] result = str.Split(strArr, StringSplitOptions.RemoveEmptyEntries); + Console.WriteLine("闪有"+(result.Length+1)+"个"); + + + } + } + + } + diff --git "a/\345\274\240\346\236\227\347\272\242/Split/Split.csproj" "b/\345\274\240\346\236\227\347\272\242/Split/Split.csproj" new file mode 100644 index 0000000000000000000000000000000000000000..c73e0d1692ab38cc8596bbd32ae080d903aaa778 --- /dev/null +++ "b/\345\274\240\346\236\227\347\272\242/Split/Split.csproj" @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + +