public StrBuf replaceRange(Range r, string str) { int s = r.start(sb.Length); int e = r.end(sb.Length); int n = e - s + 1; if (n < 0) throw IndexErr.make(r).val; sb.Remove(s, n); sb.Insert(s, str); return this; }