mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2026-02-27 17:44:35 +08:00
语法高亮,滚动条美化,设置页面调整
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<p></p><p></p>
|
||||
<p><code><strong>endsWith()</strong></code>方法用来判断当前字符串是否是以另外一个给定的子字符串“结尾”的,根据判断结果返回 <code>true</code> 或 <code>false</code>。</p>
|
||||
<h2 id="Syntax" name="Syntax">Syntax</h2>
|
||||
<pre class="syntaxbox"><code class="brush:js;"><em>str</em>.endsWith(<em>searchString</em> [, position])</code>;</pre>
|
||||
<pre><code class="language-javascript"><code class="brush:js;"><em>str</em>.endsWith(<em>searchString</em> [, position])</code>;</code></pre>
|
||||
<h3 id="Parameters" name="Parameters">参数</h3>
|
||||
<dl>
|
||||
<dt><code>searchString</code></dt>
|
||||
@@ -18,12 +18,12 @@
|
||||
<p>这个方法将帮助你确定一个字符串是否在另一个字符串的末尾,这个方法是大小写敏感的。</p>
|
||||
<h2 id="Description" name="Description"><span style="font-size: 2.142857142857143rem;">示例</span></h2>
|
||||
<h3 id="使用_endsWith()"><span style="font-size: 2.142857142857143rem;">使用 <code>endsWith()</code></span></h3>
|
||||
<pre class="brush:js;">var str = "To be, or not to be, that is the question.";
|
||||
<pre><code class="language-js;">var str = "To be, or not to be, that is the question.";
|
||||
|
||||
alert( str.endsWith("question.") ); // true
|
||||
alert( str.endsWith("to be") ); // false
|
||||
alert( str.endsWith("to be", 19) ); // true
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="Polyfill" name="Polyfill">Polyfill</h2>
|
||||
<p>这个方法已经加入到 ECMAScript 6 标准当中,但是可能还没有在所有的 JavaScript 实现中可用。然而,你可以通过如下的代码片段扩展 <code>String.prototype.endsWith()</code> 实现兼容:</p>
|
||||
<p> </p>
|
||||
@@ -35,7 +35,7 @@ alert( str.endsWith("to be", 19) ); // true
|
||||
return this.substring(this_len - search.length, this_len) === search;
|
||||
};
|
||||
}</code>
|
||||
</pre>
|
||||
</code></pre>
|
||||
<p> </p>
|
||||
<h2 id="规范">规范</h2>
|
||||
<table class="standard-table">
|
||||
|
||||
Reference in New Issue
Block a user