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

현재 번역은 완벽하지 않습니다. 한국어로 문서 번역에 동참해주세요.

요약

String.prototype 프라퍼티는 String 프로토타입 오브젝트를 표현하고 있습니다.

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

설명

모든 String 인스턴스들은 String.prototype를 상속합니다. String 프라퍼티 오브젝트를 변경하면, 그 변경은 모든 String 인스턴스들에 영향을 주게 됩니다.

Properties

String.prototype.constructor
오브젝트의 프로토타입을 생성하는 함수를 명세합니다.
String.prototype.length
문자열의 길이를 반영합니다.
N
N번째 위치에 있는 문자에 접근하기 위해 사용합니다.  N 은 0과 length보다 작은 값 사이에 있는 양의 정수입니다. 이 퍼라퍼티들은 읽기 전용(read-only) 속성을 가지고 있습니다. 

메서드

HTML과 관련이 없는 메서드

String.prototype.charAt()
문자열 내 특정 위치(index)에 있는 문자를 반환합니다.
String.prototype.charCodeAt()
문자열 내 주어진 위치(index)에 있는 문자의 유니코드 값을 반환합니다.
String.prototype.codePointAt()
주어진 위치에 있는 UTF-16으로 인코딩된 코드 포인터값인 음수가 아닌 정수값을 반환합니다. 
String.prototype.concat()
두 문자열의 문자를 합쳐서 새로운 문자열로 만든 다음, 그 새로운 문자열을 반환합니다. 
String.prototype.includes()
문자열 내에 찾고자 하는 문자열이 있는지를 확인합니다. 
String.prototype.endsWith()
문자열에서 특정 문자열로 끝나는지를 확인할 수 있습니다.
String.prototype.indexOf()
String 오브젝트에 있는 특정 값이 일치하는 첫 번째 인텍스 값을 반환하며, 일치하는 값이 없을 경우에는 -1을 반환합니다.
String.prototype.lastIndexOf()
String 오브젝트에서 fromIndex로부터 반대방향으로 찾기 시작하여 특정 값이 일치하는 마지막 인덱스를 반환합니다. 문자열에서 일치하는 특정 값이 없으면 -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.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.

HTML wrapper methods

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

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>

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

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

문서 태그 및 공헌자

 이 페이지의 공헌자: pusanbear, teoli, MoGi
 최종 변경: pusanbear,