aboutsummaryrefslogtreecommitdiff
path: root/files/nl/web/javascript/reference/global_objects/string
diff options
context:
space:
mode:
Diffstat (limited to 'files/nl/web/javascript/reference/global_objects/string')
-rw-r--r--files/nl/web/javascript/reference/global_objects/string/index.html409
-rw-r--r--files/nl/web/javascript/reference/global_objects/string/indexof/index.html200
-rw-r--r--files/nl/web/javascript/reference/global_objects/string/startswith/index.html96
-rw-r--r--files/nl/web/javascript/reference/global_objects/string/tolowercase/index.html125
-rw-r--r--files/nl/web/javascript/reference/global_objects/string/touppercase/index.html125
-rw-r--r--files/nl/web/javascript/reference/global_objects/string/trim/index.html139
6 files changed, 1094 insertions, 0 deletions
diff --git a/files/nl/web/javascript/reference/global_objects/string/index.html b/files/nl/web/javascript/reference/global_objects/string/index.html
new file mode 100644
index 0000000000..a4847a7626
--- /dev/null
+++ b/files/nl/web/javascript/reference/global_objects/string/index.html
@@ -0,0 +1,409 @@
+---
+title: String
+slug: Web/JavaScript/Reference/Global_Objects/String
+tags:
+ - ECMAScript6
+ - JavaScript
+ - NeedsTranslation
+ - Reference
+ - String
+ - TopicStub
+translation_of: Web/JavaScript/Reference/Global_Objects/String
+---
+<div>{{JSRef}}</div>
+
+<p>The <strong><code>String</code></strong> global object is a constructor for strings, or a sequence of characters.</p>
+
+<h2 id="Syntax">Syntax</h2>
+
+<p>String literals take the forms:</p>
+
+<pre class="syntaxbox"><code>'string text'
+"string text"
+"中文 español English हिन्दी العربية português বাংলা русский 日本語 ਪੰਜਾਬੀ 한국어 தமிழ்"</code></pre>
+
+<p>Strings can also be created using the <code>String</code> global object directly:</p>
+
+<pre class="syntaxbox"><code>String(thing)
+</code></pre>
+
+<h3 id="Parameters">Parameters</h3>
+
+<dl>
+ <dt><code>thing</code></dt>
+ <dd>Anything to be converted to a string.</dd>
+</dl>
+
+<h3 id="Template_strings">Template strings</h3>
+
+<p>Since ECMAScript 2015, string literals can also be so-called <a href="/en-US/docs/Web/JavaScript/Reference/template_strings">Template strings</a>:</p>
+
+<pre class="brush: js"><code>`hello world`</code>
+`hello!
+ world!`
+<code>`hello ${who}`</code>
+<code>escape `&lt;a&gt;${who}&lt;/a&gt;`</code></pre>
+
+<dl>
+</dl>
+
+<h3 id="Escape_notation">Escape notation</h3>
+
+<p>Beside regular, printable characters, special characters can be encoded using escape notation:</p>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Code</th>
+ <th scope="col">Output</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><code>\0</code></td>
+ <td>the NULL character</td>
+ </tr>
+ <tr>
+ <td><code>\'</code></td>
+ <td>single quote</td>
+ </tr>
+ <tr>
+ <td><code>\"</code></td>
+ <td>double quote</td>
+ </tr>
+ <tr>
+ <td><code>\\</code></td>
+ <td>backslash</td>
+ </tr>
+ <tr>
+ <td><code>\n</code></td>
+ <td>new line</td>
+ </tr>
+ <tr>
+ <td><code>\r</code></td>
+ <td>carriage return</td>
+ </tr>
+ <tr>
+ <td><code>\v</code></td>
+ <td>vertical tab</td>
+ </tr>
+ <tr>
+ <td><code>\t</code></td>
+ <td>tab</td>
+ </tr>
+ <tr>
+ <td><code>\b</code></td>
+ <td>backspace</td>
+ </tr>
+ <tr>
+ <td><code>\f</code></td>
+ <td>form feed</td>
+ </tr>
+ <tr>
+ <td><code>\uXXXX</code></td>
+ <td>unicode codepoint</td>
+ </tr>
+ <tr>
+ <td><code>\u{X}</code> ... <code>\u{XXXXXX}</code></td>
+ <td>unicode codepoint {{experimental_inline}}</td>
+ </tr>
+ <tr>
+ <td><code>\xXX</code></td>
+ <td>the Latin-1 character</td>
+ </tr>
+ </tbody>
+</table>
+
+<p>NOTE: Unlike some other languages, JavaScript makes no distinction between single-quoted strings and double-quoted strings, therefore, the escape sequences above work in strings created with either single or double quotes.</p>
+
+<dl>
+</dl>
+
+<h3 id="Long_literal_strings">Long literal strings</h3>
+
+<p>Sometimes, your code will include strings which are very long. Rather than having lines that go on endlessly, or wrap at the whim of your editor, you may wish to specifically break the string into multiple lines in the source code without affecting the actual string contents. There are two ways you can do this.</p>
+
+<p>You can use the <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Addition_()">+</a> operator to append multiple strings together, like this:</p>
+
+<pre class="brush: js">let longString = "This is a very long string which needs " +
+ "to wrap across multiple lines because " +
+ "otherwise my code is unreadable.";
+</pre>
+
+<p>Or you can use the backslash character ("\") at the end of each line to indicate that the string will continue on the next line. Make sure there is no space or any other character after the backslash (except for a line break), or as an indent; otherwise it will not work. That form looks like this:</p>
+
+<pre class="brush: js">let longString = "This is a very long string which needs \
+to wrap across multiple lines because \
+otherwise my code is unreadable.";
+</pre>
+
+<p>Both of these result in identical strings being created.</p>
+
+<h2 id="Description">Description</h2>
+
+<p>Strings are useful for holding data that can be represented in text form. Some of the most-used operations on strings are to check their {{jsxref("String.length", "length")}}, to build and concatenate them using the <a href="/en-US/docs/Web/JavaScript/Reference/Operators/String_Operators">+ and += string operators</a>, checking for the existence or location of substrings with the {{jsxref("String.prototype.indexOf()", "indexOf()")}} method, or extracting substrings with the {{jsxref("String.prototype.substring()", "substring()")}} method.</p>
+
+<h3 id="Character_access">Character access</h3>
+
+<p>There are two ways to access an individual character in a string. The first is the {{jsxref("String.prototype.charAt()", "charAt()")}} method:</p>
+
+<pre class="brush: js">return 'cat'.charAt(1); // returns "a"
+</pre>
+
+<p>The other way (introduced in ECMAScript 5) is to treat the string as an array-like object, where individual characters correspond to a numerical index:</p>
+
+<pre class="brush: js">return 'cat'[1]; // returns "a"
+</pre>
+
+<p>For character access using bracket notation, attempting to delete or assign a value to these properties will not succeed. The properties involved are neither writable nor configurable. (See {{jsxref("Object.defineProperty()")}} for more information.)</p>
+
+<h3 id="Comparing_strings">Comparing strings</h3>
+
+<p>C developers have the <code>strcmp()</code> function for comparing strings. In JavaScript, you just use the <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators">less-than and greater-than operators</a>:</p>
+
+<pre class="brush: js">var a = 'a';
+var b = 'b';
+if (a &lt; b) { // true
+ console.log(a + ' is less than ' + b);
+} else if (a &gt; b) {
+ console.log(a + ' is greater than ' + b);
+} else {
+ console.log(a + ' and ' + b + ' are equal.');
+}
+</pre>
+
+<p>A similar result can be achieved using the {{jsxref("String.prototype.localeCompare()", "localeCompare()")}} method inherited by <code>String</code> instances.</p>
+
+<h3 id="Distinction_between_string_primitives_and_String_objects">Distinction between string primitives and <code>String</code> objects</h3>
+
+<p>Note that JavaScript distinguishes between <code>String</code> objects and primitive string values. (The same is true of {{jsxref("Boolean")}} and {{jsxref("Global_Objects/Number", "Numbers")}}.)</p>
+
+<p>String literals (denoted by double or single quotes) and strings returned from <code>String</code> calls in a non-constructor context (i.e., without using the {{jsxref("Operators/new", "new")}} keyword) are primitive strings. JavaScript automatically converts primitives to <code>String</code> objects, so that it's possible to use <code>String</code> object methods for primitive strings. In contexts where a method is to be invoked on a primitive string or a property lookup occurs, JavaScript will automatically wrap the string primitive and call the method or perform the property lookup.</p>
+
+<pre class="brush: js">var s_prim = 'foo';
+var s_obj = new String(s_prim);
+
+console.log(typeof s_prim); // Logs "string"
+console.log(typeof s_obj); // Logs "object"
+</pre>
+
+<p>String primitives and <code>String</code> objects also give different results when using {{jsxref("Global_Objects/eval", "eval()")}}. Primitives passed to <code>eval</code> are treated as source code; <code>String</code> objects are treated as all other objects are, by returning the object. For example:</p>
+
+<pre class="brush: js">var s1 = '2 + 2'; // creates a string primitive
+var s2 = new String('2 + 2'); // creates a String object
+console.log(eval(s1)); // returns the number 4
+console.log(eval(s2)); // returns the string "2 + 2"
+</pre>
+
+<p>For these reasons, code may break when it encounters <code>String</code> objects when it expects a primitive string instead, although generally authors need not worry about the distinction.</p>
+
+<p>A <code>String</code> object can always be converted to its primitive counterpart with the {{jsxref("String.prototype.valueOf()", "valueOf()")}} method.</p>
+
+<pre class="brush: js">console.log(eval(s2.valueOf())); // returns the number 4
+</pre>
+
+<div class="note"><strong>Note:</strong> For another possible approach to strings in JavaScript, please read the article about <a href="/en-US/Add-ons/Code_snippets/StringView"><code>StringView</code> — a C-like representation of strings based on typed arrays</a>.</div>
+
+<h2 id="Properties">Properties</h2>
+
+<dl>
+ <dt>{{jsxref("String.prototype")}}</dt>
+ <dd>Allows the addition of properties to a <code>String</code> object.</dd>
+</dl>
+
+<h2 id="Methods">Methods</h2>
+
+<dl>
+ <dt>{{jsxref("String.fromCharCode()")}}</dt>
+ <dd>Returns a string created by using the specified sequence of Unicode values.</dd>
+ <dt>{{jsxref("String.fromCodePoint()")}} {{experimental_inline}}</dt>
+ <dd>Returns a string created by using the specified sequence of code points.</dd>
+ <dt>{{jsxref("String.raw()")}} {{experimental_inline}}</dt>
+ <dd>Returns a string created from a raw template string.</dd>
+</dl>
+
+<h2 id="String_generic_methods"><code>String</code> generic methods</h2>
+
+<div class="warning">
+<p><strong>String generics are non-standard, deprecated and will get removed near future</strong>. Note that you can not rely on them cross-browser without using the shim that is provided below.</p>
+</div>
+
+<p>The <code>String</code> instance methods are also available in Firefox as of JavaScript 1.6 (<strong>not</strong> part of the ECMAScript standard) on the <code>String</code> object for applying <code>String</code> methods to any object:</p>
+
+<pre class="brush: js">var num = 15;
+console.log(String.replace(num, /5/, '2'));
+</pre>
+
+<p>{{jsxref("Global_Objects/Array", "Generics", "#Array_generic_methods", 1)}} are also available on {{jsxref("Array")}} methods.</p>
+
+<p>The following is a shim to provide support to non-supporting browsers:</p>
+
+<pre class="brush: js">/*globals define*/
+// Assumes all supplied String instance methods already present
+// (one may use shims for these if not available)
+(function() {
+ 'use strict';
+
+ var i,
+ // We could also build the array of methods with the following, but the
+ // getOwnPropertyNames() method is non-shimable:
+ // Object.getOwnPropertyNames(String).filter(function(methodName) {
+ // return typeof String[methodName] === 'function';
+ // });
+ methods = [
+ 'quote', 'substring', 'toLowerCase', 'toUpperCase', 'charAt',
+ 'charCodeAt', 'indexOf', 'lastIndexOf', 'startsWith', 'endsWith',
+ 'trim', 'trimLeft', 'trimRight', 'toLocaleLowerCase',
+ 'toLocaleUpperCase', 'localeCompare', 'match', 'search',
+ 'replace', 'split', 'substr', 'concat', 'slice'
+ ],
+ methodCount = methods.length,
+ assignStringGeneric = function(methodName) {
+ var method = String.prototype[methodName];
+ String[methodName] = function(arg1) {
+ return method.apply(arg1, Array.prototype.slice.call(arguments, 1));
+ };
+ };
+
+ for (i = 0; i &lt; methodCount; i++) {
+ assignStringGeneric(methods[i]);
+ }
+}());
+</pre>
+
+<h2 id="String_instances"><code>String</code> instances</h2>
+
+<h3 id="Properties_2">Properties</h3>
+
+<div>{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/prototype', 'Properties')}}</div>
+
+<h3 id="Methods_2">Methods</h3>
+
+<h4 id="Methods_unrelated_to_HTML">Methods unrelated to HTML</h4>
+
+<div>{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/prototype', 'Methods_unrelated_to_HTML')}}</div>
+
+<h4 id="HTML_wrapper_methods">HTML wrapper methods</h4>
+
+<div>{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/prototype', 'HTML_wrapper_methods')}}</div>
+
+<h2 id="Examples">Examples</h2>
+
+<h3 id="String_conversion">String conversion</h3>
+
+<p>It's possible to use <code>String</code> as a "safer" {{jsxref("String.prototype.toString()", "toString()")}} alternative, as although it still normally calls the underlying <code>toString()</code>, it also works for {{jsxref("null")}} and {{jsxref("undefined")}}. For example:</p>
+
+<pre class="brush: js">var outputStrings = [];
+for (var i = 0, n = inputValues.length; i &lt; n; ++i) {
+ outputStrings.push(String(inputValues[i]));
+}
+</pre>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.5', 'String')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-string-objects', 'String')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-string-objects', 'String')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatChrome("1")}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ <tr>
+ <td><code>\u{XXXXXX}</code></td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoDesktop("40")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ <tr>
+ <td><code>\u{XXXXXX}</code></td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoMobile("40")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li>{{domxref("DOMString")}}</li>
+ <li><a href="/en-US/Add-ons/Code_snippets/StringView"><code>StringView</code> — a C-like representation of strings based on typed arrays</a></li>
+ <li><a href="/en-US/docs/Web/API/DOMString/Binary">Binary strings</a></li>
+</ul>
diff --git a/files/nl/web/javascript/reference/global_objects/string/indexof/index.html b/files/nl/web/javascript/reference/global_objects/string/indexof/index.html
new file mode 100644
index 0000000000..efb0b0937f
--- /dev/null
+++ b/files/nl/web/javascript/reference/global_objects/string/indexof/index.html
@@ -0,0 +1,200 @@
+---
+title: String.prototype.indexOf()
+slug: Web/JavaScript/Reference/Global_Objects/String/indexOf
+tags:
+ - JavaScript
+ - Method
+ - Prototype
+ - Reference
+ - String
+translation_of: Web/JavaScript/Reference/Global_Objects/String/indexOf
+---
+<div>{{JSRef}}</div>
+
+<p>De <strong><code>indexOf()</code></strong> methode geeft de positie van het eerste voorval van <code>searchValue</code> binnen het {{jsxref("String")}} object waarop het wordt aangeroepen, waarbij begonnen wordt met zoeken vanaf <code>fromIndex</code>. Geeft -1 terug als geen voorvallen van <code>searchValue </code>gevonden worden.</p>
+
+<h2 id="Syntaxis">Syntaxis</h2>
+
+<pre class="syntaxbox"><code><var>str</var>.indexOf(<var>searchValue</var>[, <var>fromIndex</var>]</code>)</pre>
+
+<h3 id="Parameters">Parameters</h3>
+
+<dl>
+ <dt><code>searchValue</code></dt>
+ <dd>De string om naar te zoeken.</dd>
+ <dt><code>fromIndex</code> {{optional_inline}}</dt>
+ <dd>De index vanaf waar gezocht moet worden binnen de string. Dit kan elke integer zijn. De standaard waarde is <code>0</code>, waardoor de hele string wordt doorzocht. Als <code>fromIndex &lt; 0</code> is wordt de hele string doorzocht. Als <code>fromIndex &gt;= str.length</code> is wordt de string niet doorzocht en wordt -1 teruggegeven. (behalve als <code>searchValue</code> een lege string is, dan wordt <code>str.length</code> teruggegeven)</dd>
+</dl>
+
+<h3 id="Return_waarde">Return waarde</h3>
+
+<p>De index waarop de gespecificeerde waarde het eerst voorkomt in de string; <strong>-1</strong> als die niet gevonden wordt.</p>
+
+<h2 id="Beschrijving">Beschrijving</h2>
+
+<p>Karakters in een string zijn geïndexeerd van links naar rechts. De index van het eerste karakter is 0 en de index van het laatste karakter van een string genaamd <code>stringName</code> is <code>stringName.length - 1</code>.</p>
+
+<pre class="brush: js">'Blue Whale'.indexOf('Blue'); // geeft 0 terug
+'Blue Whale'.indexOf('Blute'); // geeft -1 terug
+'Blue Whale'.indexOf('Whale', 0); // geeft 5 terug
+'Blue Whale'.indexOf('Whale', 5); // geeft 5 terug
+'Blue Whale'.indexOf('', 9); // geeft 9 terug
+'Blue Whale'.indexOf('', 10); // geeft 10 terug
+'Blue Whale'.indexOf('', 11); // geeft 11 terug
+</pre>
+
+<h3 id="Hoofdlettergevoeligheid">Hoofdlettergevoeligheid</h3>
+
+<p>De <code>indexOf()</code> methode is hoofdlettergevoelig. Het volgende voorbeeld geeft <code>-1</code> terug:</p>
+
+<pre class="brush: js">'Blue Whale'.indexOf('blue'); // geeft -1 terug
+</pre>
+
+<h3 id="Voorvallen_controleren">Voorvallen controleren</h3>
+
+<p>Onthoudt dat '0' niet vertaalt naar <code>true</code> en '-1' niet vertaalt naar <code>false</code>. Hierdoor moet op de volgende manier gekeken worden of een string binnen een andere string zit:</p>
+
+<pre class="brush: js">'Blue Whale'.indexOf('Blue') !== -1; // true
+'Blue Whale'.indexOf('Bloe') !== -1; // false
+</pre>
+
+<h2 id="Examples">Examples</h2>
+
+<h3 id="indexOf()_en_lastIndexOf()_gebruiken"><code>indexOf()</code> en <code>lastIndexOf() gebruiken</code></h3>
+
+<p>Het volgende voorbeeld gebruikt <code>indexOf()</code> en {{jsxref("String.prototype.lastIndexOf()", "lastIndexOf()")}} om waardes binnen de string  <code>"Brave new world" </code>te vinden.</p>
+
+<pre class="brush: js">var anyString = 'Brave new world';
+
+console.log('De index van de eerste w vanaf het begin is ' + anyString.indexOf('w'));
+// logs 8
+console.log('De index van de eerste w vanaf het begin is ' + anyString.lastIndexOf('w'));
+// logs 10
+
+console.log('De index van "new" vanaf het begin is ' + anyString.indexOf('new'));
+// logs 6
+console.log('De index van "new" vanaf het eind is ' + anyString.lastIndexOf('new'));
+// logs 6
+</pre>
+
+<h3 id="indexOf()_en_hoofdlettergevoeligheid"><code>indexOf()</code> en hoofdlettergevoeligheid</h3>
+
+<p>Het volgende voorbeeld legt twee string variabelen vast. Deze variabelen bevatten dezelfde string, behalve dat de tweede string hoofdletters bevat. De eerste {{domxref("console.log()")}} methode geeft <code>19</code> terug. Omdat de <code>indexOf()</code> methode hoofdlettergevoelig is, wordt de string <code>"cheddar"</code> niet gevonden in <code>myCapString</code>, dus de tweede <code>console.log()</code> methode geeft <code>-1</code> terug.</p>
+
+<pre class="brush: js">var myString = 'brie, pepper jack, cheddar';
+var myCapString = 'Brie, Pepper Jack, Cheddar';
+
+console.log('myString.indexOf("cheddar") geeft ' + myString.indexOf('cheddar'));
+// geeft 19
+console.log('myCapString.indexOf("cheddar") geeft ' + myCapString.indexOf('cheddar'));
+// geeft -1
+</pre>
+
+<h3 id="indexOf()_gebruiken_om_voorvallen_van_een_letter_in_een_string_te_tellen"><code>indexOf()</code> gebruiken om voorvallen van een letter in een string te tellen</h3>
+
+<p>In het volgende voorbeeld wordt in <code>count</code> de hoeveelheid voorvallen van <code>e</code> in de string <code>str</code> bijgehouden:</p>
+
+<pre class="brush: js">var str = 'To be, or not to be, that is the question.';
+var count = 0;
+var pos = str.indexOf('e');
+
+while (pos !== -1) {
+ count++;
+ pos = str.indexOf('e', pos + 1);
+}
+
+console.log(count); // geeft 4
+</pre>
+
+<h2 id="Specificaties">Specificaties</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specificatie</th>
+ <th scope="col">Status</th>
+ <th scope="col">Opmerking</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Eerste definitie.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.5.4.7', 'String.prototype.indexOf')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-string.prototype.indexof', 'String.prototype.indexOf')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-string.prototype.indexof', 'String.prototype.indexOf')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibiliteit">Browser compatibiliteit</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="Zie_ook">Zie ook</h2>
+
+<ul>
+ <li>{{jsxref("String.prototype.charAt()")}}</li>
+ <li>{{jsxref("String.prototype.lastIndexOf()")}}</li>
+ <li>{{jsxref("String.prototype.split()")}}</li>
+ <li>{{jsxref("Array.prototype.indexOf()")}}</li>
+</ul>
diff --git a/files/nl/web/javascript/reference/global_objects/string/startswith/index.html b/files/nl/web/javascript/reference/global_objects/string/startswith/index.html
new file mode 100644
index 0000000000..b183929746
--- /dev/null
+++ b/files/nl/web/javascript/reference/global_objects/string/startswith/index.html
@@ -0,0 +1,96 @@
+---
+title: String.prototype.startsWith()
+slug: Web/JavaScript/Reference/Global_Objects/String/startsWith
+tags:
+ - Begin
+ - JavaScript
+ - Méthode
+ - String
+translation_of: Web/JavaScript/Reference/Global_Objects/String/startsWith
+---
+<div>{{JSRef}}</div>
+
+<p><span class="seoSummary">De <strong><code>startsWith()</code></strong> methode bepaalt of een string begint met de karakters van een bepaalde string. Deze geeft <code>true</code> of <code>false</code> terug waar nodig.</span></p>
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="syntaxbox"><var>str</var>.startsWith(<em>zoek</em><var>String</var>[, <var>positie</var>])</pre>
+
+<h3 id="Parameters">Parameters</h3>
+
+<dl>
+ <dt><code>zoekString</code></dt>
+ <dd>De karakters om te zoeken aan het begin van de string.</dd>
+ <dt><code>positie</code>{{optional_inline}}</dt>
+ <dd>De positie in de string waar je start met zoeken naar <code>zoekString</code>; start standaard op 0.</dd>
+</dl>
+
+<h3 id="Resultaat">Resultaat</h3>
+
+<p><strong><code>true</code></strong> als de karakters teruggevonden worden aan het begin van de string, anders <strong><code>false</code></strong>.</p>
+
+<h2 id="Beschrijving">Beschrijving</h2>
+
+<p>Deze methde laat je nagaan of een string begint met een andere string. Dit is hoofdletter gevoelig</p>
+
+<h2 id="Voorbeelden">Voorbeelden</h2>
+
+<h3 id="Gebruik_startsWith()">Gebruik <code>startsWith()</code></h3>
+
+<pre class="brush: js">//startswith
+var str = 'Te nemen of te laten.';
+
+console.log(str.startsWith('Te nemen')); // true
+console.log(str.startsWith('te laten')); // false
+console.log(str.startsWith('te laten', 12)); // true
+</pre>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<p>Deze methode is toegevoegd aan de ECMAScript 2015 specificaties en is misschien nog niet beschikbaar in alle JavaScript implementaties. Je kan wel Polyfill  <code>String.prototype.startsWith()</code> alsvolgt gebruiken</p>
+
+<pre class="brush: js">if (!String.prototype.startsWith) {
+ String.prototype.startsWith = function(search, pos) {
+ return this.substr(!pos || pos &lt; 0 ? 0 : +pos, search.length) === search;
+ };
+}
+</pre>
+
+<p>Een meer degelijke en geoptimaliseerde Polyfill is beschikbaar <a href="https://github.com/mathiasbynens/String.prototype.startsWith">op GitHub door Mathias Bynens</a>.</p>
+
+<h2 id="Specificaties">Specificaties</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specificatie</th>
+ <th scope="col">Status</th>
+ <th scope="col">Commentaar</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-string.prototype.startswith', 'String.prototype.startsWith')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Eerste definitie.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-string.prototype.startswith', 'String.prototype.startsWith')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibiliteit">Browser compatibiliteit</h2>
+
+<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+
+<p>{{Compat("javascript.builtins.String.startsWith")}}</p>
+
+<h2 id="Meer_lezen">Meer lezen</h2>
+
+<ul>
+ <li>{{jsxref("String.prototype.endsWith()")}}</li>
+ <li>{{jsxref("String.prototype.includes()")}}</li>
+ <li>{{jsxref("String.prototype.indexOf()")}}</li>
+ <li>{{jsxref("String.prototype.lastIndexOf()")}}</li>
+</ul>
diff --git a/files/nl/web/javascript/reference/global_objects/string/tolowercase/index.html b/files/nl/web/javascript/reference/global_objects/string/tolowercase/index.html
new file mode 100644
index 0000000000..4716e5afa5
--- /dev/null
+++ b/files/nl/web/javascript/reference/global_objects/string/tolowercase/index.html
@@ -0,0 +1,125 @@
+---
+title: String.prototype.toLowerCase()
+slug: Web/JavaScript/Reference/Global_Objects/String/toLowerCase
+tags:
+ - JavaScript
+ - Method
+ - Prototype
+ - Reference
+ - String
+translation_of: Web/JavaScript/Reference/Global_Objects/String/toLowerCase
+---
+<div>{{JSRef}}</div>
+
+<p>De <strong><code>toLowerCase()</code></strong> methode geeft een string terug waarbij de meegegeven string naar kleine letters is geconverteerd.</p>
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="syntaxbox"><code><var>str</var>.toLowerCase()</code></pre>
+
+<h3 id="Returnwaarde">Returnwaarde</h3>
+
+<p>Een nieuwe string waarbij de meegegeven string naar kleine letters is geconverteerd.</p>
+
+<h2 id="Beschrijving">Beschrijving</h2>
+
+<p>De <code>toLowerCase()</code> methode geeft een string terug waarbij de meegegeven string naar kleine letters is geconverteerd. <code>toLowerCase()</code> past de waarde van de meegegeven string <code>str</code> niet aan.</p>
+
+<h2 id="Examples">Examples</h2>
+
+<h3 id="Gebruik_van_toLowerCase()">Gebruik van <code>toLowerCase()</code></h3>
+
+<pre class="brush: js">console.log('ALFABET'.toLowerCase()); // 'alfabet'
+</pre>
+
+<h2 id="Specificaties">Specificaties</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specificatie</th>
+ <th scope="col">Status</th>
+ <th scope="col">Opmerking</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initiële definitie. Geïmplementeerd in JavaScript 1.0.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.5.4.16', 'String.prototype.toLowerCase')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-string.prototype.tolowercase', 'String.prototype.toLowerCase')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-string.prototype.tolowercase', 'String.prototype.toLowerCase')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browsercompatibiliteit">Browsercompatibiliteit</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basisondersteuning</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basisondersteuning</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="Zie_ook">Zie ook</h2>
+
+<ul>
+ <li>{{jsxref("String.prototype.toLocaleLowerCase()")}}</li>
+ <li>{{jsxref("String.prototype.toLocaleUpperCase()")}}</li>
+ <li>{{jsxref("String.prototype.toUpperCase()")}}</li>
+</ul>
diff --git a/files/nl/web/javascript/reference/global_objects/string/touppercase/index.html b/files/nl/web/javascript/reference/global_objects/string/touppercase/index.html
new file mode 100644
index 0000000000..32393e3c86
--- /dev/null
+++ b/files/nl/web/javascript/reference/global_objects/string/touppercase/index.html
@@ -0,0 +1,125 @@
+---
+title: String.prototype.toUpperCase()
+slug: Web/JavaScript/Reference/Global_Objects/String/toUpperCase
+tags:
+ - JavaScript
+ - Method
+ - Prototype
+ - Reference
+ - String
+translation_of: Web/JavaScript/Reference/Global_Objects/String/toUpperCase
+---
+<div>{{JSRef}}</div>
+
+<p>De <strong><code>toUpperCase()</code></strong> methode geeft een string terug waarbij de meegegeven string naar hoofdletters is geconverteerd.</p>
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="syntaxbox"><code><var>str</var>.toUpperCase()</code></pre>
+
+<h3 id="Returnwaarde">Returnwaarde</h3>
+
+<p>Een nieuwe string waarbij de meegegeven string naar hoofdletters is geconverteerd.</p>
+
+<h2 id="Beschrijving">Beschrijving</h2>
+
+<p>De <code>toUpperCase()</code> methode geeft een string terug waarbij de meegegeven string naar hoofdletters is geconverteerd.. <code>toUpperCase()</code> past de waarde van de meegegeven string niet aan.</p>
+
+<h2 id="Voorbeelden">Voorbeelden</h2>
+
+<h3 id="Gebruik_van_toUpperCase()">Gebruik van <code>toUpperCase()</code></h3>
+
+<pre class="brush: js">console.log('alfabet'.toUpperCase()); // 'ALFABET'
+</pre>
+
+<h2 id="Specificaties">Specificaties</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specificatie</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initiële definitie. Geïmplementeerd in JavaScript 1.0.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.5.4.18', 'String.prototype.toUpperCase')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-string.prototype.touppercase', 'String.prototype.toUpperCase')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-string.prototype.touppercase', 'String.prototype.toUpperCase')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browsercompatibiliteit">Browsercompatibiliteit</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basisondersteuning</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basisondersteuning</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="Zie_ook">Zie ook</h2>
+
+<ul>
+ <li>{{jsxref("String.prototype.toLocaleLowerCase()")}}</li>
+ <li>{{jsxref("String.prototype.toLocaleUpperCase()")}}</li>
+ <li>{{jsxref("String.prototype.toLowerCase()")}}</li>
+</ul>
diff --git a/files/nl/web/javascript/reference/global_objects/string/trim/index.html b/files/nl/web/javascript/reference/global_objects/string/trim/index.html
new file mode 100644
index 0000000000..c595279b0d
--- /dev/null
+++ b/files/nl/web/javascript/reference/global_objects/string/trim/index.html
@@ -0,0 +1,139 @@
+---
+title: String.prototype.trim()
+slug: Web/JavaScript/Reference/Global_Objects/String/Trim
+tags:
+ - ECMAScript6
+ - JavaScript
+ - Method
+ - Prototype
+ - Reference
+ - String
+translation_of: Web/JavaScript/Reference/Global_Objects/String/Trim
+---
+<div>{{JSRef}}</div>
+
+<p>De <strong><code>trim()</code></strong> methode verwijdert witruimte aan het begin en einde van een string. Witruimte betreft in deze context alle whitespace karakters (spatie, tab, no-break spatie, etc.) en alle regeleindekarakters (LF, CR, etc.).</p>
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="syntaxbox"><code><var>str</var>.trim()</code></pre>
+
+<h3 id="Returnwaarde">Returnwaarde</h3>
+
+<p>Een nieuwe string waarbij de meegegeven string geen witruimte aan beide kanten meer heeft.</p>
+
+<h2 id="Beschrijving">Beschrijving</h2>
+
+<p>De <code>trim()</code> methode geeft een string terug waarvan aan het begin en einde de witruimte is afgestript. <code>trim()</code> past de waarde van de string zelf niet aan.</p>
+
+<h2 id="Voorbeelden">Voorbeelden</h2>
+
+<h3 id="Het_gebruik_van_trim()">Het gebruik van <code>trim()</code></h3>
+
+<p>Het volgende voorbeeld toont de string <code>'foo'</code>:</p>
+
+<pre class="brush: js">var orig = ' foo ';
+console.log(orig.trim()); // 'foo'
+
+// Ander voorbeeld .trim() voor het verwijderen van witruimte aan een kant.
+
+var orig = 'foo ';
+console.log(orig.trim()); // 'foo'
+</pre>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<p>Roep de volgende code aan voor het aanroepen van andere code, om <code>trim()</code> beschikbaar te maken als deze nog niet oorspronkelijk ondersteund werd.</p>
+
+<pre class="brush: js">if (!String.prototype.trim) {
+  String.prototype.trim = function () {
+  return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
+ };
+}
+</pre>
+
+<h2 id="Specificaties">Specificaties</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specificatie</th>
+ <th scope="col">Status</th>
+ <th scope="col">Opmerking</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.5.4.20', 'String.prototype.trim')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>Initiële definitie. Geïmplementeerd in JavaScript 1.8.1.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-string.prototype.trim', 'String.prototype.trim')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-string.prototype.trim', 'String.prototype.trim')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browsercompatibiliteit">Browsercompatibiliteit</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basisondersteuning</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoDesktop("1.9.1")}}</td>
+ <td>{{CompatIE("9")}}</td>
+ <td>{{CompatOpera("10.5")}}</td>
+ <td>{{CompatSafari("5")}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basisondersteuning</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="Zie_ook">Zie ook</h2>
+
+<ul>
+ <li>{{jsxref("String.prototype.trimLeft()")}} {{non-standard_inline}}</li>
+ <li>{{jsxref("String.prototype.trimRight()")}} {{non-standard_inline}}</li>
+</ul>