|
发表于 2019-11-12 12:01:31
|
显示全部楼层
山东省潍坊市
易语言的已经有了.写了个C#的.vLine跟lLine是结果
- var a = "01 02 03 04 05 06 07\r\n08 09 10 11 12 13 14\r\n15 16 17 18 19 20 21\r\n22 23 24 25 26 27 28\r\n29 30 31 32 33 34 35\r\n36 37 38 39 40 41 42\r\n43 44 45 46 47 48 49";
- var b = a.Split(new string[] {"\r\n" },StringSplitOptions.RemoveEmptyEntries).Select(s=> { return s.Split(new string[] { " " },StringSplitOptions.RemoveEmptyEntries); }).ToList();
- var yCount = b.Count;
- var xCount = b[0].Count();
- int x = 0, y = 0, index = 0;
- string words = "43";
- string lLine = "", vLine = "";
- var tmp= b.Where((s, j) => s.Contains(words)).FirstOrDefault();
- if(tmp!=null)
- {
- xCount = tmp.Length;
- lLine = words[1].ToString();
- index=x = Array.IndexOf(tmp, words);
- x++;
- x = x % xCount;
- lLine += tmp[x][1].ToString();
- x -= 2;
- x = x <0 ? x + xCount : x;
- lLine = tmp[x][1] + lLine;
- vLine = words[1].ToString();
- y = b.IndexOf(tmp);
- y = ++y % yCount;
- vLine += b[y][index][1].ToString();
- y -= 2;
- y = y >=0 ? y : y + yCount;
- vLine = b[y][index][1].ToString()+vLine;
-
- }
复制代码 |
|