aboutsummaryrefslogtreecommitdiff
path: root/files/ko/conflicting/web/javascript/reference/global_objects/string/index.html
blob: b8c4064d6cff9e652030fb6b90a0314879a4bb57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
---
title: String.prototype
slug: conflicting/Web/JavaScript/Reference/Global_Objects/String
tags:
  - JavaScript
  - Property
  - Prototype
  - String
translation_of: Web/JavaScript/Reference/Global_Objects/String
translation_of_original: Web/JavaScript/Reference/Global_Objects/String/prototype
original_slug: Web/JavaScript/Reference/Global_Objects/String/prototype
---
<div>{{JSRef("Global_Objects", "String")}}</div>

<h2 id="Summary" name="Summary">요약</h2>

<p><strong><code>String.prototype</code></strong> 프라퍼티는 {{jsxref("Global_Objects/String", "String")}} 프로토타입 오브젝트를 표현하고 있습니다.</p>

<div>{{js_property_attributes(0, 0, 0)}}</div>

<h2 id="Description" name="Description">설명</h2>

<p>모든 {{jsxref("Global_Objects/String", "String")}} 인스턴스들은 <code>String.prototype</code>를 상속합니다. <code>String</code> 프라퍼티 오브젝트를 변경하면, 그 변경은 모든 {{jsxref("Global_Objects/String", "String")}} 인스턴스들에 영향을 주게 됩니다.</p>

<h2 id="Properties" name="Properties">Properties</h2>

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

<h2 id="Methods" name="Methods">메서드</h2>

<h3 id="Methods_unrelated_to_HTML" name="Methods_unrelated_to_HTML">HTML과 관련이 없는 메서드</h3>

<dl>
 <dt>{{jsxref("String.prototype.charAt()")}}</dt>
 <dd>문자열 내 특정 위치(index)에 있는 문자를 반환합니다.</dd>
 <dt>{{jsxref("String.prototype.charCodeAt()")}}</dt>
 <dd>문자열 내 주어진 위치(index)에 있는 문자의 유니코드 값을 반환합니다.</dd>
 <dt>{{jsxref("String.prototype.codePointAt()")}} {{experimental_inline}}</dt>
 <dd>주어진 위치에 있는 UTF-16으로 인코딩된 코드 포인터값인 음수가 아닌 정수값을 반환합니다. </dd>
 <dt>{{jsxref("String.prototype.concat()")}}</dt>
 <dd>두 문자열의 문자를 합쳐서 새로운 문자열로 만든 다음, 그 새로운 문자열을 반환합니다. </dd>
 <dt>{{jsxref("String.prototype.includes()")}} {{experimental_inline}}</dt>
 <dd>문자열 내에 찾고자 하는 문자열이 있는지를 확인합니다. </dd>
 <dt>{{jsxref("String.prototype.endsWith()")}} {{experimental_inline}}</dt>
 <dd>문자열에서 특정 문자열로 끝나는지를 확인할 수 있습니다.</dd>
 <dt>{{jsxref("String.prototype.indexOf()")}}</dt>
 <dd>{{jsxref("Global_Objects/String", "String")}} 오브젝트에 있는 특정 값이 일치하는 첫 번째 인덱스 값을 반환하며, 일치하는 값이 없을 경우에는 -1을 반환합니다.</dd>
 <dt>{{jsxref("String.prototype.lastIndexOf()")}}</dt>
 <dd><a href="https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/String" title="String 글로벌 오브젝트는 문자열의 생성자, 또는 문자열의 순서입니다."><code>String</code></a> 오브젝트에서 <code>fromIndex</code>로부터 반대방향으로 찾기 시작하여 특정 값이 일치하는 마지막 인덱스를 반환합니다. 문자열에서 일치하는 특정 값이 없으면 <code>-1</code>을 리턴합니다.</dd>
 <dt>{{jsxref("String.prototype.localeCompare()")}}</dt>
 <dd>Returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order.</dd>
 <dt>{{jsxref("String.prototype.match()")}}</dt>
 <dd>Used to match a regular expression against a string.</dd>
 <dt>{{jsxref("String.prototype.normalize()")}} {{experimental_inline}}</dt>
 <dd>Returns the Unicode Normalization Form of the calling string value.</dd>
 <dt><s class="obsoleteElement">{{jsxref("String.prototype.quote()")}} {{obsolete_inline}}</s></dt>
 <dd><s class="obsoleteElement">Wraps the string in double quotes ("<code>"</code>").</s></dd>
 <dt>{{jsxref("String.prototype.repeat()")}} {{experimental_inline}}</dt>
 <dd>Returns a string consisting of the elements of the object repeated the given times.</dd>
 <dt>{{jsxref("String.prototype.replace()")}}</dt>
 <dd>Used to find a match between a regular expression and a string, and to replace the matched substring with a new substring.</dd>
 <dt>{{jsxref("String.prototype.search()")}}</dt>
 <dd>Executes the search for a match between a regular expression and a specified string.</dd>
 <dt>{{jsxref("String.prototype.slice()")}}</dt>
 <dd>Extracts a section of a string and returns a new string.</dd>
 <dt>{{jsxref("String.prototype.split()")}}</dt>
 <dd>Splits a {{jsxref("Global_Objects/String", "String")}} object into an array of strings by separating the string into substrings.</dd>
 <dt>{{jsxref("String.prototype.startsWith()")}} {{experimental_inline}}</dt>
 <dd>Determines whether a string begins with the characters of another string.</dd>
 <dt>{{jsxref("String.prototype.substr()")}}</dt>
 <dd>Returns the characters in a string beginning at the specified location through the specified number of characters.</dd>
 <dt>{{jsxref("String.prototype.substring()")}}</dt>
 <dd>Returns the characters in a string between two indexes into the string.</dd>
 <dt>{{jsxref("String.prototype.toLocaleLowerCase()")}}</dt>
 <dd>The characters within a string are converted to lower case while respecting the current locale. For most languages, this will return the same as {{jsxref("String.prototype.toLowerCase()", "toLowerCase()")}}.</dd>
 <dt>{{jsxref("String.prototype.toLocaleUpperCase()")}}</dt>
 <dd>The characters within a string are converted to upper case while respecting the current locale. For most languages, this will return the same as {{jsxref("String.prototype.toUpperCase()", "toUpperCase()")}}.</dd>
 <dt>{{jsxref("String.prototype.toLowerCase()")}}</dt>
 <dd>Returns the calling string value converted to lower case.</dd>
 <dt>{{jsxref("String.prototype.toSource()")}} {{non-standard_inline}}</dt>
 <dd>Returns an object literal representing the specified object; you can use this value to create a new object. Overrides the {{jsxref("Object.prototype.toSource()")}} method.</dd>
 <dt>{{jsxref("String.prototype.toString()")}}</dt>
 <dd>Returns a string representing the specified object. Overrides the {{jsxref("Object.prototype.toString()")}} method.</dd>
 <dt>{{jsxref("String.prototype.toUpperCase()")}}</dt>
 <dd>Returns the calling string value converted to uppercase.</dd>
 <dt>{{jsxref("String.prototype.trim()")}}</dt>
 <dd>Trims whitespace from the beginning and end of the string. Part of the ECMAScript 5 standard.</dd>
 <dt>{{jsxref("String.prototype.trimLeft()")}} {{non-standard_inline}}</dt>
 <dd>Trims whitespace from the left side of the string.</dd>
 <dt>{{jsxref("String.prototype.trimRight()")}} {{non-standard_inline}}</dt>
 <dd>Trims whitespace from the right side of the string.</dd>
 <dt>{{jsxref("String.prototype.valueOf()")}}</dt>
 <dd>Returns the primitive value of the specified object. Overrides the {{jsxref("Object.prototype.valueOf()")}} method.</dd>
 <dt>{{jsxref("String.prototype.@@iterator()", "String.prototype[@@iterator]()")}} {{experimental_inline}}</dt>
 <dd>Returns a new <code>Iterator</code> object that iterates over the code points of a String value, returning each code point as a String value.</dd>
</dl>

<h3 id="HTML_wrapper_methods" name="HTML_wrapper_methods">HTML wrapper methods</h3>

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

<dl>
 <dt>{{jsxref("String.prototype.big()")}} {{deprecated_inline}}</dt>
 <dd>{{HTMLElement("big")}}</dd>
 <dt>{{jsxref("String.prototype.blink()")}} {{deprecated_inline}}</dt>
 <dd>{{HTMLElement("blink")}}</dd>
 <dt>{{jsxref("String.prototype.bold()")}} {{deprecated_inline}}</dt>
 <dd>{{HTMLElement("b")}}</dd>
 <dt>{{jsxref("String.prototype.fixed()")}} {{deprecated_inline}}</dt>
 <dd>{{HTMLElement("tt")}}</dd>
 <dt>{{jsxref("String.prototype.fontcolor()")}} {{deprecated_inline}}</dt>
 <dd>{{htmlattrxref("color", "font", "&lt;font color=\"color\"&gt;")}}</dd>
 <dt>{{jsxref("String.prototype.fontsize()")}} {{deprecated_inline}}</dt>
 <dd>{{htmlattrxref("size", "font", "&lt;font size=\"size\"&gt;")}}</dd>
 <dt>{{jsxref("String.prototype.italics()")}} {{deprecated_inline}}</dt>
 <dd>{{HTMLElement("i")}}</dd>
 <dt>{{jsxref("String.prototype.link()")}}</dt>
 <dd>{{htmlattrxref("href", "a", "&lt;a href=\"rul\"&gt;")}} (link to URL)</dd>
 <dt>{{jsxref("String.prototype.small()")}} {{deprecated_inline}}</dt>
 <dd>{{HTMLElement("small")}}</dd>
 <dt>{{jsxref("String.prototype.strike()")}} {{deprecated_inline}}</dt>
 <dd>{{HTMLElement("strike")}}</dd>
 <dt>{{jsxref("String.prototype.sub()")}} {{deprecated_inline}}</dt>
 <dd>{{HTMLElement("sub")}}</dd>
 <dt>{{jsxref("String.prototype.sup()")}} {{deprecated_inline}}</dt>
 <dd>{{HTMLElement("sup")}}</dd>
</dl>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>ECMAScript 1st Edition.</td>
   <td>Standard</td>
   <td>Initial definition.</td>
  </tr>
  <tr>
   <td>{{SpecName('ES5.1', '#sec-15.5.3.1', 'String.prototype')}}</td>
   <td>{{Spec2('ES5.1')}}</td>
   <td></td>
  </tr>
  <tr>
   <td>{{SpecName('ES6', '#sec-string.prototype', 'String.prototype')}}</td>
   <td>{{Spec2('ES6')}}</td>
   <td></td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<div>{{CompatibilityTable}}</div>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Chrome for Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<h2 id="See_also" name="See_also">See also</h2>

<ul>
 <li>{{jsxref("Global_Objects/String", "String")}}</li>
 <li>{{jsxref("Function.prototype")}}</li>
</ul>