diff options
Diffstat (limited to 'files/zh-tw/web/javascript/reference/global_objects/string/index.html')
-rw-r--r-- | files/zh-tw/web/javascript/reference/global_objects/string/index.html | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/files/zh-tw/web/javascript/reference/global_objects/string/index.html b/files/zh-tw/web/javascript/reference/global_objects/string/index.html index 8ab9244b71..e29b6b8cea 100644 --- a/files/zh-tw/web/javascript/reference/global_objects/string/index.html +++ b/files/zh-tw/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> @@ -22,7 +22,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String <pre>String(thing)</pre> -<h3 id="Parameters" name="Parameters">參數</h3> +<h3 id="Parameters">參數</h3> <dl> <dt><code>thing</code></dt> @@ -130,11 +130,11 @@ otherwise my code is unreadable.";</code></pre> <p>這兩個方法都會建立相同的字串內容。</p> -<h2 id="Description" name="Description">說明</h2> +<h2 id="Description">說明</h2> <p>字串對於能保留以文字形式表達的資料這件事來說,是有用的。在字串上,一些最常被使用的運算即確認字串長度 {{jsxref("String.length", "length")}} ,用 <a href="/en-US/docs/Web/JavaScript/Reference/Operators/String_Operators">+ 或 += 字串運算元</a> 建造或者串接字串,用 {{jsxref("String.indexOf", "indexOf")}} 方法檢查?子字串是否存在或子字串的位置,或者是用 {{jsxref("String.substring", "substring")}} 方法將子字串抽取出來。</p> -<h3 id="Character_access" name="Character_access">存取字元</h3> +<h3 id="Character_access">存取字元</h3> <p>有兩個方法可以存取字串中個別的字元。第一個是用 {{jsxref("String.charAt", "charAt")}} 方法:</p> @@ -148,7 +148,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="/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators">小於和大於運算子</a>:</p> @@ -194,7 +194,7 @@ console.log(eval(s2)); // 回傳字串 "2 + 2" <div class="note"><strong>注意:</strong> 對於在 JavaScript 中其他可用的字串方法,請參閱這篇文章<a href="/en-US/docs/Web/JavaScript/Typed_arrays/StringView" title="/en-US/docs/Web/JavaScript/Typed_arrays/StringView"><code>StringView</code> – a C-like representation of strings based on typed arrays</a>。</div> -<h2 id="Properties" name="Properties">屬性</h2> +<h2 id="Properties">屬性</h2> <dl> <dt>{{jsxref("String.prototype")}}</dt> @@ -203,7 +203,7 @@ console.log(eval(s2)); // 回傳字串 "2 + 2" <div>{{jsOverrides("Function", "Properties", "prototype")}}</div> -<h2 id="Methods" name="Methods">方法</h2> +<h2 id="Methods">方法</h2> <dl> <dt>{{jsxref("String.fromCharCode()")}}</dt> @@ -261,7 +261,7 @@ alert(String.replace(num, /5/, '2')); } }());</pre> -<h2 id="String_instances" name="String_instances"><code>String</code> instances</h2> +<h2 id="String_instances"><code>String</code> instances</h2> <h3 id="Properties_2">Properties</h3> |