Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 89356d7

Browse files
matchAll()replace()replaceAll()charCodeAt()codePointAt()fromCharCode()fromCodePoint()normalize()toLowerCase()toUpperCase()
1 parent 904b226 commit 89356d7

File tree

1 file changed

+86
-1
lines changed

1 file changed

+86
-1
lines changed

‎String methods/script.js

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,92 @@
182182
// // groups: undefined
183183
// // ]
184184

185-
// console.log(text.match(/ain/)); // sme result as "search()" method
185+
// console.log(text.match(/ain/)); // same result as "search()" method
186186
// console.log(text.match(/ain/g));//it returns how many "comparestring" available inside of string
187187
// console.log(text.match(/ain/gi));//it returns how many "comparestring" available inside of string but both cases lowerCase and UpperCase
188188
// console.log(text.match(/w/));// if method failed it returns "null"
189+
190+
191+
// MATCHALL() METHOD //
192+
193+
// SYNTAXES //
194+
//string.matchAll()
195+
// let text = 'The rain in SPAIN stays mainly in the plain';
196+
// // let s = text.matchAll('ain')//it returns all matched strings inside referenceString and their position all stuff
197+
// // console.log(...s);
198+
// // let a = text.matchAll(/ain/g)////it returns all matched strings inside referenceString and their position all stuff
199+
// // console.log(...a);
200+
// let b = text.matchAll(/ain/gi)////it returns all matched strings inside referenceString and their position all stuff but both cases lowercase and upperCase
201+
// console.log(...b);
202+
// let e = text.matchAll(/w/gi)//if method failed it returns empty array [];
203+
204+
205+
// REPLACE() METHOD //
206+
// SYNTAXES //
207+
// string.replace(searchString,replacerString) ---- string.replace(regexp,replacerString);
208+
// string.replace(searchString,replacerFunction) ----- string.replace(regexp,replacerFunction);
209+
// let text = 'Mr Blue has blue car and a blue house ';
210+
// let res = text.replace('blue','green')
211+
// let res1 = text.replace('blue',(match)=>{
212+
// return match.toUpperCase()
213+
// })
214+
// let res2 = text.replace(/blue/g,'green')
215+
// let res3 = text.replace(/blue/gi,'green')
216+
// let res4 = text.replace(/blue/g,(match)=>{
217+
// return match.toUpperCase()
218+
// })
219+
// console.log(res);
220+
// console.log(res1);
221+
// console.log(res2);
222+
// console.log(res3);
223+
// console.log(res4);
224+
225+
// REPLACEALL() METHOD //
226+
// SYNTAXES //
227+
// string.replaceAll(searchString,replacerString) ---- string.replaceAll(regexp,replacerString);
228+
// string.replaceAll(searchString,replacerFunction) ----- string.replaceAll(regexp,replacerFunction);
229+
// let text = 'Mr Blue has blue car and a blue house ';
230+
// let res = text.replaceAll('blue','yellow')
231+
// let res1 = text.replaceAll('blue',(match)=>{
232+
// return match.toUpperCase()
233+
// })
234+
// let res2 = text.replaceAll(/blue/g,'yellow')
235+
// let res3 = text.replaceAll(/blue/gi,'yellow')
236+
// let res4 = text.replaceAll(/blue/g,(match)=>{
237+
// return match.toUpperCase()
238+
// })
239+
// console.log(res);
240+
// console.log(res1);
241+
// console.log(res2);
242+
// console.log(res3);
243+
// console.log(res4);
244+
245+
246+
// CHARCODEAT() AND CODEPOINTAT() METHODS //
247+
// SYNTAXES //
248+
// string.charCodeAt(position) ---------- string.codePointAt(position)
249+
//UTF-16 UniCode
250+
// 0 AND 65535 0 and 65535 & > 65535
251+
252+
253+
// FROMCHARCODE() AND FROMCODEPOINT() METHODS //
254+
// SYNTAXES //
255+
// String.fromCharCode(num) ---------- String.fromCodePoint(num)
256+
// String.fromCharCode(num,num1,...,numN) ---------- String.fromCodePoint(num,num1,...,numN)
257+
258+
259+
// NORMALIZE() METHOD //
260+
// SYNTAXES //
261+
// string.normalize()
262+
// string.normalize(form) UNICODE NORMALIZATION FORMS : "NFS","NFD","NFKC" OR "NFKD"
263+
264+
265+
// TOLOWERCASE() --- TOUPPERCASE() METHODS //
266+
// SYNTAXES //
267+
// string.toLowerCase() ------ string.toUpperCase()
268+
269+
const greeting = "hello WORLD";
270+
let lowerS = greeting.toLowerCase()
271+
let upperC = greeting.toUpperCase()
272+
console.log(lowerS);
273+
console.log(upperC);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /