static int charIndexOfRow(S text, int row) { int i = 0; while (row-- > 0 && i < l(text)) i = smartIndexOf(text, '\n', i)+1; ret min(i, l(text)); }