标签:size 字符 int lin mat ceiling page -- add
int pageSize=5;
var array = new List<string>();
----------方法1--------------------
var pageCount = (int)Math.Ceiling(1.0 * small.Length / pageSize);
for (int i = 0; i < pageCount; i++)
{
var bb = small1.Skip(i * pageSize).Take(pageSize).ToArray();
array.Add(new string(bb));
}
----------方法2--------------------
var i = 0;
while (small1.Length>i)
{
var str = small1.Substring(i, Math.Min(pageSize, small1.Length-i));
array.Add(str);
i = i + pageSize;
}
标签:size 字符 int lin mat ceiling page -- add
原文地址:http://www.cnblogs.com/simadi/p/7728664.html