static function iter($s, $chars) { $len = haxe_Utf8::length($s); $_g = 0; while ($_g < $len) { $i = $_g++; call_user_func_array($chars, array(haxe_Utf8::charCodeAt($s, $i))); unset($i); } }
static function getLength($s) { $i8 = 0; $n8 = haxe_Utf8::length($s); $counter16 = 0; while ($i8 < $n8) { $charCode = haxe_Utf8::charCodeAt($s, $i8); if ($charCode < 55296 || $charCode > 56319) { ++$counter16; } ++$i8; unset($charCode); } return $counter16; }
public function quote($s) { if (strlen($s) !== haxe_Utf8::length($s)) { $this->quoteUtf8($s); return; } $this->buf->b .= "\""; $i = 0; while (true) { $c = null; $index = $i++; $c = ord(substr($s, $index, 1)); unset($index); if ($c === 0) { break; } switch ($c) { case 34: $this->buf->add("\\\""); break; case 92: $this->buf->add("\\\\"); break; case 10: $this->buf->add("\\n"); break; case 13: $this->buf->add("\\r"); break; case 9: $this->buf->add("\\t"); break; case 8: $this->buf->add("\\b"); break; case 12: $this->buf->add("\\f"); break; default: $this->buf->b .= _hx_string_or_null(chr($c)); break; } unset($c); } $this->buf->b .= "\""; }