Tento překlad není kompletní. Prosím pomozte přeložit tento článek z angličtiny.
Souhrn
Vlastnost String.prototype
reprezentuje prototypový objekt String
.
Property attributes of String.prototype |
|
---|---|
Writable | no |
Enumerable | no |
Configurable | no |
Popis
Všechny instance String
dědí ze String.prototype
. Změny v prototypovém objektu String
se přenášejí do všech instancí String
.
Vlastnosti
-
String.prototype.constructor
- Určuje funkci, která vytváří prototyp objektu.
-
String.prototype.length
- Reprezentuje délku řetězce.
- N
-
Používá se pro přístup ke znaku Nté pozici, kde N je kladné celé číslo od 0 do hodnoty o 1 menší než
length
. Tyto vlastnosti jsou pouze pro čtení.
Metody
Metody nesouvisející s HTML
-
String.prototype.charAt()
- Vrací znak na určeném indexu.
-
String.prototype.charCodeAt()
- Vrací číslo označující hodnotu Unicode pro znak na daném indexu.
-
String.prototype.codePointAt()
- Vrací nezáporné celé číslo, které představuje hodnotu znaku v UTF-16 (code point) na dané pozici.
-
String.prototype.concat()
- Spojí texty dvou řetězců a vrací nový řetězec.
-
String.prototype.contains()
- Zjišťuje, zda je řetězec součástí jiného řetězce.
-
String.prototype.endsWith()
- Zjišťuje, jestli řetězec končí znaky jiného řetězce.
-
String.prototype.indexOf()
- Vrací index prvního výskytu dané hodnty v objektu String, který metodu volá. Pokud nic není nalezeno, vrací -1.
-
String.prototype.lastIndexOf()
- Vrací index posledního výskytu dané hodnty v objektu String, který metodu volá. Pokud nic není nalezeno, vrací -1.
-
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.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.
Metody pro obalení HTML
Tyto metody mají omezené použití, protože obsahují pouze část dostupných HTML tagů a atributů.
-
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="url">
(link to URL) -
String.prototype.small()
-
<small>
-
String.prototype.strike()
-
<strike>
-
String.prototype.sub()
-
<sub>
-
String.prototype.sup()
-
<sup>
Specifikace
Specifikace | Stav | Komentář |
---|---|---|
ECMAScript 1. edice. | Standardní | První definice. |
ECMAScript 5.1 (ECMA-262) The definition of 'String.prototype' in that specification. |
Standard | |
ECMAScript 6 (ECMA-262) The definition of 'String.prototype' in that specification. |
Release Candidate |
Kompatibilita v prohlížečích
Vlastnost | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Základní podpora | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
Vlastnost | Android | Chrome pro Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Základní podpora | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |