先转化成数组用数组取的方式
public List<string> CToALLFour(string _lotteryNumber)
{string mm = "";
int j = 0;
while (j < 5000)
{
string[] array = _lotteryNumber.Split(',');
for (int i = 1; i < array.Length; i++)
{
mm = array[i];
}
j++;
}
return null;
}
25ms;
private void button1_Click(object sender, RoutedEventArgs e)
{
//MessageBox.Show("hello");
//client.LoginAsync("aj","aj");
var mm = DateTime.Now;
var mx = CToALLFour("5,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,4,8,6,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,3,8,1,2,3,4,5,1,2,3,4,5,6,7,8,9");
MessageBox.Show((DateTime.Now -mm).ToString());
}
直接一个一个截取
public List<string> CToALLFour(string _lotteryNumber) //四星转所有组合
{
string mm = "";
int j = 0;
while (j < 5000)
{
for (int i = 1; i < _lotteryNumber.Length; i++)
{
mm = _lotteryNumber.Substring(i, 1);
}
j++;
}
return null;
}
32ms左右
所以先转化成数组的方式稍快一点