public List split(string s, long limit)
{
int l = (limit < 0) ? 0 : (int)limit;
List result = new List(m_pattern.Split(s, l));
// to match java we need to discard any trailing
// emptys strings (use limit, not l)
if (limit == 0)
{
while (result.sz() > 0 && (result.last() as string).Length == 0)
{
result.pop();
}
}
return(result);
}