mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-12-15 07:06:53 +08:00
语法高亮,滚动条美化,设置页面调整
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<div></div>
|
||||
<p><strong><code>codePointAt()</code></strong> 方法返回 一个 Unicode 编码点值的非负整数。</p>
|
||||
<h2 id="语法">语法</h2>
|
||||
<pre class="syntaxbox"><code><var>str</var>.codePointAt(<var>pos</var>)</code></pre>
|
||||
<pre><code class="language-javascript"><code><var>str</var>.codePointAt(<var>pos</var>)</code></code></pre>
|
||||
<h3 id="参数">参数</h3>
|
||||
<dl>
|
||||
<dt><code>pos</code></dt>
|
||||
@@ -15,14 +15,14 @@
|
||||
<p>Surrogate Pair是UTF-16中用于扩展字符而使用的编码方式,是一种采用四个字节(两个UTF-16编码)来表示一个字符,称作代理对。</p>
|
||||
<h2 id="例子">例子</h2>
|
||||
<h3 id="使用_codePointAt()">使用 <code>codePointAt()</code></h3>
|
||||
<pre class="brush: js">'ABC'.codePointAt(1); // 66
|
||||
<pre><code class="language-javascript">'ABC'.codePointAt(1); // 66
|
||||
'\uD800\uDC00'.codePointAt(0); // 65536
|
||||
|
||||
'XYZ'.codePointAt(42); // undefined
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="替补支持(Polyfill)">替补支持(Polyfill)</h2>
|
||||
<p>给原生不支持 ECMAScript 6 的浏览器使用<code>codePointAt()</code>方法的的一个字符串扩展方法。</p>
|
||||
<pre class="brush: js">/*! http://mths.be/codepointat v0.1.0 by @mathias */
|
||||
<pre><code class="language-javascript">/*! http://mths.be/codepointat v0.1.0 by @mathias */
|
||||
if (!String.prototype.codePointAt) {
|
||||
(function() {
|
||||
'use strict'; // 严格模式,needed to support `apply`/`call` with `undefined`/`null`
|
||||
@@ -67,7 +67,7 @@ if (!String.prototype.codePointAt) {
|
||||
}
|
||||
}());
|
||||
}
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="规范">规范</h2>
|
||||
<table class="standard-table">
|
||||
<tbody>
|
||||
|
||||
Reference in New Issue
Block a user