diff options
Diffstat (limited to 'files/pt-br/web/javascript/reference/global_objects/symbol/split/index.html')
-rw-r--r-- | files/pt-br/web/javascript/reference/global_objects/symbol/split/index.html | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/files/pt-br/web/javascript/reference/global_objects/symbol/split/index.html b/files/pt-br/web/javascript/reference/global_objects/symbol/split/index.html new file mode 100644 index 0000000000..c6b9e13fd3 --- /dev/null +++ b/files/pt-br/web/javascript/reference/global_objects/symbol/split/index.html @@ -0,0 +1,60 @@ +--- +title: Symbol.split +slug: Web/JavaScript/Reference/Global_Objects/Symbol/split +translation_of: Web/JavaScript/Reference/Global_Objects/Symbol/split +--- +<div>{{JSRef}}</div> + +<p>O <code><strong>Symbol.split</strong></code> é um símbolo conhecido que especifica o método que divide uma string nos índices correspondentes a uma expressão regular. Essa função é chamada pelo método {{jsxref("String.prototype.split()")}}.</p> + +<p>Para mais informações, veja {{jsxref("RegExp.@@split", "RegExp.prototype[@@split]()")}} e {{jsxref("String.prototype.split()")}}.</p> + +<div>{{EmbedInteractiveExample("pages/js/symbol-split.html")}}</div> + +<div class="hidden">The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> and send us a pull request.</div> + +<div>{{js_property_attributes(0,0,0)}}</div> + +<h2 id="Exemplos">Exemplos</h2> + +<h3 id="Divisão_reversa_personalizada">Divisão reversa personalizada</h3> + +<pre class="brush: js notranslate">class ReverseSplit { + [Symbol.split](string) { + const array = string.split(' '); + return array.reverse(); + } +} + +console.log('Another one bites the dust'.split(new ReverseSplit())); +// resultado esperado: [ "dust", "the", "bites", "one", "Another" ]</pre> + +<h2 id="Especificações">Especificações</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Especificação</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('ESDraft', '#sec-symbol.split', 'Symbol.split')}}</td> + </tr> + </tbody> +</table> + +<h2 id="Compatibilidade_de_navegador">Compatibilidade de navegador</h2> + + + +<p>{{Compat("javascript.builtins.Symbol.split")}}</p> + +<h2 id="Veja_também">Veja também</h2> + +<ul> + <li>{{jsxref("Symbol.match")}}</li> + <li>{{jsxref("Symbol.replace")}}</li> + <li>{{jsxref("Symbol.search")}}</li> + <li>{{jsxref("RegExp.@@split", "RegExp.prototype[@@split]()")}}</li> +</ul> |