core :: String :: read_until_char
self
until to
is encountered and store result in buffer
.Returns to
position or -1
if not found.
# Reads `self` until `to` is encountered and store result in `buffer`.
#
# Returns `to` position or `-1` if not found.
private fun read_until_char(from: Int, char: Char, buffer: Buffer): Int do
if from < 0 or from >= length then return -1
var pos = from
while pos > -1 and pos < length do
var c = self[pos]
if c == char then return pos
buffer.add c
pos += 1
end
return -1
end
lib/template/macro.nit:321,2--334,4