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