111,126
社区成员
发帖
与我相关
我的任务
分享using System;
using System.Text.RegularExpressions;
class Program
{
static void Main(string[] args)
{
string ss = "a|bc|de|fg|hi|jk|lm|no|pq|rs|tu|vw|xy|z";
string[] t = Regex.Split(ss, @"(?<=\w)(?=\w)");
foreach (string s in t)
{
Console.WriteLine(s);
}
}
}
/* 程序输出:
a|b
c|d
e|f
g|h
i|j
k|l
m|n
o|p
q|r
s|t
u|v
w|x
y|z
*/ string ss = "a|bc|de|fg|hi|jk|lm|no|pq|rs|tu|vw|xy|z";
string[] t = Regex.Split(ss, @"(?<=\w)(?=\w)");
string ss="a|bc|de|fg|hi|jk|lm|no|pq|rs|tu|vw|xy|z";
int arrLength=0;
if(ss.Length%3!=0)
arrLength=ss.Length/3+1;
else
arrLength=ss.Length/3;
string[] array=new string[arrLength];
for(int i=0;i<arrLength;i++)
{
array[i]=ss.Substring(i*3,3);
}