self
at position pos
NOTE: length
defaults to 1, expressed in chars
var b = new Buffer
b.append("美しい 世界")
b.remove_at(3)
assert b == "美しい世界"
b.remove_at(1, 2)
assert b == "美世界"
# Removes a substring from `self` at position `pos`
#
# NOTE: `length` defaults to 1, expressed in chars
#
# ~~~
# var b = new Buffer
# b.append("美しい 世界")
# b.remove_at(3)
# assert b == "美しい世界"
# b.remove_at(1, 2)
# assert b == "美世界"
# ~~~
fun remove_at(pos: Int, length: nullable Int) is abstract
lib/core/text/abstract_text.nit:1757,2--1769,58
redef fun remove_at(p, len) do
if len == null then len = 1
if len == 0 then return
var its = _items
var bst = char_to_byte_index(p)
var bend = char_to_byte_index(p + len - 1)
bend += its.char_at(bend).u8char_len
var blen = bend - bst
lshift_bytes(bend, bend - bst)
byte_length -= blen
length -= len
end
lib/core/text/flat.nit:1122,2--1133,4