guanyongxin
2015-06-18 15:11:56 +08:00
public static void SplitStr(int count,ArrayList list)
{
try
{
if (count > list.Count) { PutInHtml((string[])list.ToArray(typeof(string))); return; }
Random r = new Random();
int z = list.Count / count;
ArrayList yu = new ArrayList();
int start = list.Count;
for (int i = 0; i < start; i++)
{
yu.Add(list[i]);
list.RemoveAt(i);
if (list.Count % count == 0) { PutInHtml((string[])yu.ToArray(typeof(string))); Thread.Sleep(r.Next(1000, 4500)); break; }
}
var all = (string[])list.ToArray(typeof(string));
string[] items;
string info = string.Empty;
for (var i = 0; i < z; ++i)
{
items = all.Skip(i).Take(count).ToArray();
PutInHtml(items);
Thread.Sleep(r.Next(1000, 4500));
}
}
catch { }
}
这样处理了,先把余数解决,之后可以整除的就用楼上的方法