diff --git a/src/io/lacuna/bifurcan/Rope.java b/src/io/lacuna/bifurcan/Rope.java index 7827553..f911634 100644 --- a/src/io/lacuna/bifurcan/Rope.java +++ b/src/io/lacuna/bifurcan/Rope.java @@ -292,6 +292,18 @@ public IntStream chars() { public IntStream codePoints() { return IntIterators.toStream(Rope.this.codePoints(), root.numCodePoints()); } + + @Override + public String toString() { + char[] cs = new char[root.numCodeUnits()]; + Iterator it = chunks(); + int offset = 0; + while (it.hasNext()) { + offset += UnicodeChunk.writeCodeUnits(cs, offset, it.next()); + } + + return new String(cs); + } }; }