Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

String.prototype

This translation is incomplete. Please help translate this article from English.

La propietat String.prototype representa l'objecte prototip String.

Property attributes of String.prototype
Writable no
Enumerable no
Configurable no

Descripció

Totes les instàncies String hereten de String.prototype. Canvis en l'objecte prototip  String són propagats a totes les instàncies String.

Propietats

String.prototype.constructor
Especifica la funció que crea el prototip d'un objecte.
String.prototype.length
Reflecteix la llargària de la cadena.
N
S'utilitza per accedir al caràcter que es troba en la Nth posició on N és un número sencer positiu entre 0 i un menys que el valor de length. Aquestes propietas només són llegibles.

Mètodes

Mètodes no relacionats amb HTML

String.prototype.charAt()
Retorna el caràcter en l'índex especificat.
String.prototype.charCodeAt()
Retorna el nombre enter a number indicating the Unicode value of the character at the given index.
String.prototype.codePointAt()
Retorna un enter no negatiu que the UTF-16 encoded code point value at the given position.
String.prototype.concat()
Combina el text de dues cadenes i retorna una nova cadena.
String.prototype.includes()
Determina si una cadena es pot trobar dins d'una altra cadena o no.
String.prototype.endsWith()
Determina si una cadena acaba amb els caràcters d'una altra cadena.
String.prototype.indexOf()
Returns the index within the calling String object of the first occurrence of the specified value, or -1 if not found.
String.prototype.lastIndexOf()
Returns the index within the calling String object of the last occurrence of the specified value, or -1 if not found.
String.prototype.localeCompare()
Returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order.
String.prototype.match()
Used to match a regular expression against a string.
String.prototype.normalize()
Returns the Unicode Normalization Form of the calling string value.
String.prototype.quote()
Wraps the string in double quotes (""").
String.prototype.repeat()
Returns a string consisting of the elements of the object repeated the given times.
String.prototype.replace()
Used to find a match between a regular expression and a string, and to replace the matched substring with a new substring.
String.prototype.search()
Executes the search for a match between a regular expression and a specified string.
String.prototype.slice()
Extracts a section of a string and returns a new string.
String.prototype.split()
Splits a String object into an array of strings by separating the string into substrings.
String.prototype.startsWith()
Determines whether a string begins with the characters of another string.
String.prototype.substr()
Returns the characters in a string beginning at the specified location through the specified number of characters.
String.prototype.substring()
Returns the characters in a string between two indexes into the string.
String.prototype.toLocaleLowerCase()
The characters within a string are converted to lower case while respecting the current locale. For most languages, this will return the same as toLowerCase().
String.prototype.toLocaleUpperCase()
The characters within a string are converted to upper case while respecting the current locale. For most languages, this will return the same as toUpperCase().
String.prototype.toLowerCase()
Returns the calling string value converted to lower case.
String.prototype.toSource()
Returns an object literal representing the specified object; you can use this value to create a new object. Overrides the Object.prototype.toSource() method.
String.prototype.toString()
Returns a string representing the specified object. Overrides the Object.prototype.toString() method.
String.prototype.toUpperCase()
Returns the calling string value converted to uppercase.
String.prototype.trim()
Trims whitespace from the beginning and end of the string. Part of the ECMAScript 5 standard.
String.prototype.trimLeft()
Trims whitespace from the left side of the string.
String.prototype.trimRight()
Trims whitespace from the right side of the string.
String.prototype.valueOf()
Returns the primitive value of the specified object. Overrides the Object.prototype.valueOf() method.
String.prototype[@@iterator]()
Returns a new Iterator object that iterates over the code points of a String value, returning each code point as a String value.

Mètodes embolcalladors d'HTML

Aquests mètodes són d'ús limitat, ja que només proveeixen un subconjunt d'etiquetes i atributs disponibles.

String.prototype.anchor()
<a name="name"> (hypertext target)
String.prototype.big()
<big>
String.prototype.blink()
<blink>
String.prototype.bold()
<b>
String.prototype.fixed()
<tt>
String.prototype.fontcolor()
<font color="color">
String.prototype.fontsize()
<font size="size">
String.prototype.italics()
<i>
String.prototype.link()
<a href="rul"> (link to URL)
String.prototype.small()
<small>
String.prototype.strike()
<strike>
String.prototype.sub()
<sub>
String.prototype.sup()
<sup>

Especificacions

Especificació Estat Comentaris
ECMAScript 1st Edition (ECMA-262) Standard Definició inicial.
ECMAScript 5.1 (ECMA-262)
The definition of 'String.prototype' in that specification.
Standard  
ECMAScript 2015 (6th Edition, ECMA-262)
The definition of 'String.prototype' in that specification.
Standard  

Compatibilitat amb navegadors

Característica Chrome Firefox (Gecko) Internet Explorer Opera Safari
Suport bàsic (Yes) (Yes) (Yes) (Yes) (Yes)
Característica Android Chrome per Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Suport bàsic (Yes) (Yes) (Yes) (Yes) (Yes) (Yes)

Vegeu també

Document Tags and Contributors

 Contributors to this page: llue
 Last updated by: llue,