+ redef fun substring(from, count) do
+ if from < 0 then
+ count += from
+ if count < 0 then return ""
+ from = 0
+ end
+
+ var ln = _length
+ if (count + from) > ln then count = ln - from
+ if count <= 0 then return ""
+ var end_index = from + count - 1
+
+ var flps = _flat_last_pos_start
+ if flps != -1 and from >= flps and end_index <= _flat_last_pos_end then
+ return _flat_cache.substring_impl(from - flps, count, end_index - flps)
+ end
+
+ var lft = _left
+ var llen = lft.length