Returns the Unicode char escaped by self

assert "\\u0041".from_utf16_escape == 'A'
assert "\\ud800\\udfd3".from_utf16_escape == '๐“'
assert "\\u00e8".from_utf16_escape == 'รจ'
assert "\\u3042".from_utf16_escape == 'ใ‚'

Property definitions

core $ Text :: from_utf16_escape
	# Returns the Unicode char escaped by `self`
	#
	# ~~~
	# assert "\\u0041".from_utf16_escape == 'A'
	# assert "\\ud800\\udfd3".from_utf16_escape == '๐“'
	# assert "\\u00e8".from_utf16_escape == 'รจ'
	# assert "\\u3042".from_utf16_escape == 'ใ‚'
	# ~~~
	fun from_utf16_escape(pos, ln: nullable Int): Char do
		if pos == null then pos = 0
		if ln == null then ln = length - pos
		if ln < 6 then return 0xFFFD.code_point
		var cp = from_utf16_digit(pos + 2).to_u32
		if cp < 0xD800u32 then return cp.code_point
		if cp > 0xDFFFu32 then return cp.code_point
		if cp > 0xDBFFu32 then return 0xFFFD.code_point
		if ln == 6 then return 0xFFFD.code_point
		if ln < 12 then return 0xFFFD.code_point
		cp <<= 16
		cp += from_utf16_digit(pos + 8).to_u32
		var cplo = cp & 0xFFFFu32
		if cplo < 0xDC00u32 then return 0xFFFD.code_point
		if cplo > 0xDFFFu32 then return 0xFFFD.code_point
		return cp.from_utf16_surr.code_point
	end
lib/core/text/abstract_text.nit:857,2--881,4