Copies n bytes from self at src_offset into dest starting at dest_offset

Basically a high-level synonym of CString::copy_to

REQUIRE: n must be large enough to contain len bytes

var ns = new CString(8)
"Text is String".copy_to_native(ns, 8, 2, 0)
assert ns.to_s_with_length(8) == "xt is St"

Property definitions

core $ Text :: copy_to_native
	# Copies `n` bytes from `self` at `src_offset` into `dest` starting at `dest_offset`
	#
	# Basically a high-level synonym of CString::copy_to
	#
	# REQUIRE: `n` must be large enough to contain `len` bytes
	#
	# ~~~
	# var ns = new CString(8)
	# "Text is String".copy_to_native(ns, 8, 2, 0)
	# assert ns.to_s_with_length(8) == "xt is St"
	# ~~~
	fun copy_to_native(dest: CString, n, src_offset, dest_offset: Int) do
		var mypos = src_offset
		var itspos = dest_offset
		while n > 0 do
			dest[itspos] = self.bytes[mypos]
			itspos += 1
			mypos += 1
			n -= 1
		end
	end
lib/core/text/abstract_text.nit:1215,2--1235,4

core $ FlatText :: copy_to_native
	redef fun copy_to_native(dest, n, src_offset, dest_offset) do
		items.copy_to(dest, n, src_offset, dest_offset)
	end
lib/core/text/abstract_text.nit:1440,2--1442,4

core :: flat $ FlatText :: copy_to_native
	redef fun copy_to_native(dst, n, src_off, dst_off) do
		_items.copy_to(dst, n, first_byte + src_off, dst_off)
	end
lib/core/text/flat.nit:403,2--405,4

core $ Concat :: copy_to_native
	redef fun copy_to_native(dest, n, src_offset, dest_offset) do
		var l = _left
		if src_offset < l.byte_length then
			var lcopy = l.byte_length - src_offset
			lcopy = if lcopy > n then n else lcopy
			l.copy_to_native(dest, lcopy, src_offset, dest_offset)
			dest_offset += lcopy
			n -= lcopy
			src_offset = 0
		end
		_right.copy_to_native(dest, n, src_offset, dest_offset)
	end
lib/core/text/ropes.nit:226,2--237,4