String.prototype

Podsumowanie

Reprezentuje prototyp obiekt贸w danej klasy. Pozwala na dodawanie w艂asno艣ci i metod do wszystkich instancji tej klasy.

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

Opis

Wszystkie instancje String dziedzicz膮 z  String.prototype. Zmiany w prototypie obiektu String s膮 propagowane do wszystkich instancji String.

W艂asno艣ci

String.prototype.constructor
Oznacza funkcj臋, kt贸ra tworzy prototyp obiektu.
String.prototype.length (en-US)
Odzwierciedla d艂ugo艣膰 艂a艅cucha znak贸w.
N
U偶ywane celem uzyskania dost臋pu do znaku na pozycji N-tej gdzie  N jest dodatni膮 liczb膮 ca艂kowit膮 mi臋dzy 0 a o jeden mniejsz膮 od length (en-US). W艂asno艣ci te s膮 tylko do odczytu.

Metody

Metody niezwi膮zane z HTML

String.prototype.charAt()
Zwraca znak o podanym indeksie.
String.prototype.charCodeAt()
Zwraca liczb臋 oznaczaj膮c膮 warto艣膰 Unicode znaku o podanym indeksie.
String.prototype.codePointAt() (en-US) This is an experimental API that should not be used in production code.
Returns a non-negative integer that is the UTF-16 encoded code point value at the given position.
String.prototype.concat()
艁膮czy dwa 艂a艅cuchy znak贸w i zwraca nowy 艂a艅cuch.
String.prototype.includes() (en-US) This is an experimental API that should not be used in production code.
Determines whether one string may be found within another string.
String.prototype.endsWith() (en-US) This is an experimental API that should not be used in production code.
Determines whether a string ends with the characters of another string.
String.prototype.indexOf() (en-US)
Zwraca indeks pierwszego wyst膮pienia podanego znaku w obiekcie String lub -1, gdy niczego nie znaleziono.
String.prototype.lastIndexOf() (en-US)
Zwraca indeks ostatniego wyst膮pienia podanego znaku w obiekcie String lub -1, gdy niczego nie znaleziono.
String.prototype.localeCompare() (en-US)
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() (en-US)
U偶ywane do por贸wnania wyra偶enia regularnego z 艂a艅cuchem znak贸w.
String.prototype.normalize() (en-US) This is an experimental API that should not be used in production code.
Returns the Unicode Normalization Form of the calling string value.
String.prototype.quote() This is an obsolete API and is no longer guaranteed to work.
Wraps the string in double quotes (""").
String.prototype.repeat() This is an experimental API that should not be used in production code.
Returns a string consisting of the elements of the object repeated the given times.
String.prototype.replace() (en-US)
U偶ywane do znalezienia podobie艅stwa pomi臋dzy wyra偶eniem regularnym a 艂a艅cuchem znak贸w, a nast臋pnie do podmiany znalezionego pod艂a艅cucha nowym pod艂a艅cuchem.
String.prototype.search()
Uruchamia wyszukiwanie podobie艅stwa pomi臋dzy wyra偶eniem regularnym a podanym 艂a艅cuchem.
String.prototype.slice()
Wyci膮ga kawa艂ek 艂a艅cucha i zwraca nowy 艂a艅cuch.
String.prototype.split() (en-US)
Dzieli obiekt String na tablic臋 艂a艅cuch贸w poprzez dzielenie 艂a艅cucha na pod艂a艅cuchy.
String.prototype.startsWith() (en-US) This is an experimental API that should not be used in production code.
Determines whether a string begins with the characters of another string.
String.prototype.substr()
Zwraca pod艂a艅cuch znak贸w z 艂a艅cucha, zaczynaj膮cy si臋 w podanym miejscu i podanej d艂ugo艣ci znak贸w.
String.prototype.substring()
Zwraca znaki w pod艂a艅cuchu pomi臋dzy dwoma indeksami w 艂a艅cuchu.
String.prototype.toLocaleLowerCase() (en-US)
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() (en-US)
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()
Zwraca wywo艂uj膮cy 艂a艅cuch skonwertowany do ma艂ych liter.
String.prototype.toSource() This API has not been standardized.
Zwraca litera艂 obiektu reprezentuj膮cy podany obiekt; mo偶esz u偶y膰 tej warto艣ci do utworzenia nowego obiektu. Przes艂ania metod臋 Object.prototype.toSource().
String.prototype.toString()
Zwraca 艂a艅cuch reprezentuj膮cy podany obiekt. Przes艂ania metod臋 Object.prototype.toString().
String.prototype.toUpperCase()
Zwraca wywo艂uj膮cy 艂a艅cuch skonwertowany do wielkich liter.
String.prototype.trim() (en-US)
Trims whitespace from the beginning and end of the string. Part of the ECMAScript 5 standard.
String.prototype.trimLeft() (en-US) This API has not been standardized.
Trims whitespace from the left side of the string.
String.prototype.trimRight() (en-US) This API has not been standardized.
Trims whitespace from the right side of the string.
String.prototype.valueOf()
Zwraca warto艣膰 prymitywn膮 podanego obiektu. Przes艂ania metod臋 Object.prototype.valueOf().
String.prototype[@@iterator]() (en-US) This is an experimental API that should not be used in production code.
Returns a new Iterator object that iterates over the code points of a String value, returning each code point as a String value.

Metody zwi膮zane z HTML

These methods are of limited use, as they provide only a subset of the available HTML tags and attributes.

String.prototype.anchor()
<a name="name"> (hypertext target)
String.prototype.big() This deprecated API should no longer be used, but will probably still work.
<big>
String.prototype.blink() This deprecated API should no longer be used, but will probably still work.
<blink>
String.prototype.bold() This deprecated API should no longer be used, but will probably still work.
<b>
String.prototype.fixed() (en-US) This deprecated API should no longer be used, but will probably still work.
<tt>
String.prototype.fontcolor() This deprecated API should no longer be used, but will probably still work.
<font color="color"> (en-US)
String.prototype.fontsize() This deprecated API should no longer be used, but will probably still work.
<font size="size"> (en-US)
String.prototype.italics() This deprecated API should no longer be used, but will probably still work.
<i>
String.prototype.link()
<a href="rul"> (link to URL)
String.prototype.small() This deprecated API should no longer be used, but will probably still work.
<small>
String.prototype.strike() This deprecated API should no longer be used, but will probably still work.
<strike> (en-US)
String.prototype.sub() This deprecated API should no longer be used, but will probably still work.
<sub> (en-US)
String.prototype.sup() This deprecated API should no longer be used, but will probably still work.
<sup> (en-US)

Specifications

Specification Status Comment
ECMAScript 1st Edition. Standard Initial definition.
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  

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help! (en-US)
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support (Yes) (Yes) (Yes) (Yes) (Yes)
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (Yes) (Yes) (Yes) (Yes) (Yes) (Yes)

See also