private ArrayList Wrap(string value)
{
if (value == null || (value = value.Trim()).Length <= 0)
return null;
string[] values = value.Split(' ');
ArrayList list = new ArrayList();
string current = "";
for (int i = 0; i < values.Length; ++i)
{
string val = values[i];
string v = current.Length == 0 ? val : current + ' ' + val;
if (v.Length < 10)
{
current = v;
}
else if (v.Length == 10)
{
list.Add(v);
if (list.Count == 6)
return list;
current = "";
}
else if (val.Length <= 10)
{
list.Add(current);
if (list.Count == 6)
return list;
current = val;
}
else
{
while (v.Length >= 10)
{
list.Add(v.Substring(0, 10));
if (list.Count == 6)
return list;
v = v.Substring(10);
}
current = v;
}
}
if (current.Length > 0)
list.Add(current);
return list;
}