aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/javascript/reference/global_objects/string
diff options
context:
space:
mode:
authort7yang <t7yang@gmail.com>2022-01-10 08:38:07 +0800
committerIrvin <irvinfly@gmail.com>2022-02-16 02:35:54 +0800
commit563ca0a35e98678e2b7d5f154f31f496851e8d60 (patch)
tree7c99e7e037128217eca2080df671a742076c615b /files/zh-cn/web/javascript/reference/global_objects/string
parentd7b2995cabe8d85a1827aa18bc270bdf739f3d13 (diff)
downloadtranslated-content-563ca0a35e98678e2b7d5f154f31f496851e8d60.tar.gz
translated-content-563ca0a35e98678e2b7d5f154f31f496851e8d60.tar.bz2
translated-content-563ca0a35e98678e2b7d5f154f31f496851e8d60.zip
remove code tag inside pre tag for zh-CN
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/string')
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/string/match/index.html16
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/string/padstart/index.html8
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/string/repeat/index.html4
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/string/tolowercase/index.html2
4 files changed, 15 insertions, 15 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/string/match/index.html b/files/zh-cn/web/javascript/reference/global_objects/string/match/index.html
index 33a3a57880..f369a7a7f9 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/string/match/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/string/match/index.html
@@ -60,7 +60,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String/match
<p>在下例中,使用 <code>match</code> 查找 "<code>Chapter</code>" 紧跟着 1 个或多个数值字符,再紧跟着一个小数点和数值字符 0 次或多次。正则表达式包含 <code>i</code> 标志,因此大小写会被忽略。</p>
-<pre class="brush: js line-numbers language-js"><code class="language-js">var str = 'For more information, see Chapter 3.4.5.1';
+<pre class="brush: js line-numbers language-js">var str = 'For more information, see Chapter 3.4.5.1';
var re = /see (chapter \d+(\.\d)*)/i;
var found = str.match(re);
@@ -76,30 +76,30 @@ console.log(found);
// 'Chapter 3.4.5.1' 被'(chapter \d+(\.\d)*)'捕获。
// '.1' 是被'(\.\d)'捕获的最后一个值。
// 'index' 属性(22) 是整个匹配从零开始的索引。
-// 'input' 属性是被解析的原始字符串。</code></pre>
+// 'input' 属性是被解析的原始字符串。</pre>
<h3 id="Example_Using_global_and_ignore_case_flags_with_match" name="Example:_Using_global_and_ignore_case_flags_with_match">例子:<code>match</code> 使用全局(global)和忽略大小写(ignore case)标志</h3>
<p>下例展示了 <code>match</code> 使用 global 和 ignore case 标志。A-E、a-e 的所有字母将会作为一个数组的元素返回。</p>
-<pre class="brush: js line-numbers language-js"><code class="language-js">var str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
+<pre class="brush: js line-numbers language-js">var str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
var regexp = /[A-E]/gi;
var matches_array = str.match(regexp);
console.log(matches_array);
-// ['A', 'B', 'C', 'D', 'E', 'a', 'b', 'c', 'd', 'e']</code></pre>
+// ['A', 'B', 'C', 'D', 'E', 'a', 'b', 'c', 'd', 'e']</pre>
<h3 id="使用match,不传参数"><code>使用match(),不传参数 </code></h3>
-<pre class="brush: js line-numbers language-js"><code class="language-js">var str = "Nothing will come of nothing.";
+<pre class="brush: js line-numbers language-js">var str = "Nothing will come of nothing.";
-str.match(); // returns [""]</code></pre>
+str.match(); // returns [""]</pre>
<h3 id="一个非正则表达式对象作为参数">一个非正则表达式对象作为参数</h3>
<p>当参数是一个字符串或一个数字,它会使用new RegExp(obj)来隐式转换成一个 {{jsxref("RegExp")}}。如果它是一个有正号的正数,RegExp() 方法将忽略正号。</p>
-<pre class="brush: js line-numbers language-js"><code class="language-js">var str1 = "NaN means not a number. Infinity contains -Infinity and +Infinity in JavaScript.",
+<pre class="brush: js line-numbers language-js">var str1 = "NaN means not a number. Infinity contains -Infinity and +Infinity in JavaScript.",
str2 = "My grandfather is 65 years old and My grandmother is 63 years old.",
str3 = "The contract was declared null and void.";
str1.match("number"); // "number" 是字符串。返回["number"]
@@ -109,7 +109,7 @@ str1.match(+Infinity); // 返回["Infinity"]
str1.match(-Infinity); // 返回["-Infinity"]
str2.match(65); // 返回["65"]
str2.match(+65); // 有正号的number。返回["65"]
-str3.match(null); // 返回["null"]</code></pre>
+str3.match(null); // 返回["null"]</pre>
<h2 id="规范">规范</h2>
diff --git a/files/zh-cn/web/javascript/reference/global_objects/string/padstart/index.html b/files/zh-cn/web/javascript/reference/global_objects/string/padstart/index.html
index 98d0f201ed..c358da2585 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/string/padstart/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/string/padstart/index.html
@@ -35,17 +35,17 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String/padStart
<h2 id="示例">示例</h2>
-<pre class="brush: js line-numbers language-js"><code class="language-js">'abc'.padStart(10); // " abc"
+<pre class="brush: js line-numbers language-js">'abc'.padStart(10); // " abc"
'abc'.padStart(10, "foo"); // "foofoofabc"
'abc'.padStart(6,"123465"); // "123abc"
'abc'.padStart(8, "0"); // "00000abc"
-'abc'.padStart(1); // "abc"</code></pre>
+'abc'.padStart(1); // "abc"</pre>
<h2 id="Polyfill">Polyfill</h2>
<p>如果原生环境不支持该方法,在其他代码之前先运行下面的代码,将创建 <code>String.prototype.padStart()</code> 方法。</p>
-<pre class="brush: js line-numbers language-js"><code class="language-js">// https://github.com/uxitten/polyfill/blob/master/string.polyfill.js
+<pre class="brush: js line-numbers language-js">// https://github.com/uxitten/polyfill/blob/master/string.polyfill.js
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart
if (!String.prototype.padStart) {
String.prototype.padStart = function padStart(targetLength,padString) {
@@ -62,7 +62,7 @@ if (!String.prototype.padStart) {
return padString.slice(0,targetLength) + String(this);
}
};
-}</code>
+}
</pre>
<h2 id="规范">规范</h2>
diff --git a/files/zh-cn/web/javascript/reference/global_objects/string/repeat/index.html b/files/zh-cn/web/javascript/reference/global_objects/string/repeat/index.html
index c0ee77fe21..e412b0da5c 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/string/repeat/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/string/repeat/index.html
@@ -44,7 +44,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String/repeat
<p>此方法已添加到 ECMAScript 2015 规范中,并且可能尚未在所有 JavaScript 实现中可用。然而,你可以使用以下代码段对 String.prototype.repeat() 进行填充:</p>
-<pre class="brush: js language-js"><code class="language-js">if (!String.prototype.repeat) {
+<pre class="brush: js language-js">if (!String.prototype.repeat) {
String.prototype.repeat = function(count) {
'use strict';
if (this == null) {
@@ -83,7 +83,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String/repeat
}
return rpt;
}
-}</code></pre>
+}</pre>
<h2 id="Examples" name="Examples">示例</h2>
diff --git a/files/zh-cn/web/javascript/reference/global_objects/string/tolowercase/index.html b/files/zh-cn/web/javascript/reference/global_objects/string/tolowercase/index.html
index 7db9f1e146..e8fd231457 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/string/tolowercase/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/string/tolowercase/index.html
@@ -15,7 +15,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String/toLowerCase
<h2 id="语法">语法</h2>
-<pre class="syntaxbox language-html"><code class="language-html">str.toLowerCase()</code>
+<pre class="syntaxbox language-html">str.toLowerCase()
</pre>
<h3 id="返回值">返回值</h3>