diff options
author | t7yang <t7yang@gmail.com> | 2022-01-10 08:38:07 +0800 |
---|---|---|
committer | Irvin <irvinfly@gmail.com> | 2022-02-16 02:35:54 +0800 |
commit | c40612041809fe289aba58aefa170bbe784aba1f (patch) | |
tree | 8ca89b071d04afcf7abd6d9a04d0765a041d9c8a /files/zh-cn/web/javascript/reference/global_objects/string/index.html | |
parent | 12a899ab8540bc84f56a0dc6491be80a48499d49 (diff) | |
download | translated-content-c40612041809fe289aba58aefa170bbe784aba1f.tar.gz translated-content-c40612041809fe289aba58aefa170bbe784aba1f.tar.bz2 translated-content-c40612041809fe289aba58aefa170bbe784aba1f.zip |
remove name attribute for zh-CN
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/string/index.html')
-rw-r--r-- | files/zh-cn/web/javascript/reference/global_objects/string/index.html | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/string/index.html b/files/zh-cn/web/javascript/reference/global_objects/string/index.html index bcfc0bf5ec..6b8d96b0ac 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/string/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/string/index.html @@ -12,7 +12,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String <p><strong><code>String</code></strong> 全局对象是一个用于字符串或一个字符序列的构造函数。</p> -<h2 id="Syntax" name="Syntax">语法</h2> +<h2 id="Syntax">语法</h2> <p>字符串字面量采取以下形式:</p> @@ -35,20 +35,20 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String <pre class="syntaxbox">String(thing) new String(thing)</pre> -<h3 id="Parameters" name="Parameters">参数</h3> +<h3 id="Parameters">参数</h3> <dl> <dt><code>thing</code></dt> <dd>任何可以被转换成字符串的值。</dd> </dl> -<h3 id="Parameters" name="Parameters">模板字面量</h3> +<h3 id="Parameters">模板字面量</h3> <p>从 ECMAScript 2015 开始,字符串字面量也可以称为<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals">模板字面量</a>:</p> <pre>`hello world` `hello! world!` `hello ${who}` escape `<a>${who}</a>`</pre> -<h3 id="Parameters" name="Parameters">转义字符</h3> +<h3 id="Parameters">转义字符</h3> <dl> </dl> @@ -141,11 +141,11 @@ otherwise my code is unreadable.";</code></pre> <dl> </dl> -<h2 id="Description" name="Description">描述</h2> +<h2 id="Description">描述</h2> <p>字符串对于保存可以以文本形式表示的数据非常有用。 一些常用的字符串操作有:查询<a href="/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/String/length">字符串长度</a>,使用<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/String_Operators"> + 和 += </a>运算符来构建和连接字符串,使用 <a href="/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf">indexOf</a> 方法检查某一子字符串在父字符串中的位置,又或是使用 <a href="/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/String/substring">substring</a> 方法提取从父字符串中提取子字符串。</p> -<h3 id="Character_access" name="Character_access">从字符串中获取单个字符</h3> +<h3 id="Character_access">从字符串中获取单个字符</h3> <p>获取字符串的某个字符有两种方法。 第一种是使用 {{jsxref("String.charAt", "charAt")}} 方法:</p> @@ -159,7 +159,7 @@ otherwise my code is unreadable.";</code></pre> <p>使用括号访问字符串不可以对其进行删除或添加,因为字符串对应未知的属性并不是可读或配置的。 (更多的信息请参阅 {{jsxref("Object.defineProperty")}}。 )</p> -<h3 id="Comparing_strings" name="Comparing_strings">字符串比较</h3> +<h3 id="Comparing_strings">字符串比较</h3> <p>熟练使用 C 语言的开发者经常使用 <code>strcmp</code> 函数来比较字符串,但在 JavaScript 中,你只需要使用<a href="/zh-CN/docs/Web/JavaScript/Reference/Operators/Comparison_Operators">比较操作符(>/</>=/<=)</a>:</p> @@ -212,7 +212,7 @@ console.log(eval(s2)); // returns the string "2 + 2" <dd>可以为 String 对象增加新的属性。</dd> </dl> -<h2 id="Methods" name="Methods">方法</h2> +<h2 id="Methods">方法</h2> <dl> <dt>{{jsxref("String.fromCharCode()")}} </dt> @@ -247,7 +247,7 @@ console.log(String.replace(num, /5/, '2')); <p class="brush: js">{{jsxref("Global_Objects/Array", "Generics", "#Array_generic_methods", 1)}} 在 Javascript 1.6 中同样支持{{jsxref("Global_Objects/Array", "Array")}}。</p> -<h2 id="String_instances" name="String_instances"><code>String</code> 实例</h2> +<h2 id="String_instances"><code>String</code> 实例</h2> <h3 id="属性_2">属性</h3> |