-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring.js
More file actions
43 lines (32 loc) · 1.62 KB
/
string.js
File metadata and controls
43 lines (32 loc) · 1.62 KB
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
// string method list
// length (retuns the entire length)
// toUpperCase() (converts entire string to upper case)
// toLowerCase() (converts entire string to lower case)
// charAt(index) (index starts from 0 , if we give 2 , 3 rd word will be output
// indexOf () () should mention in string "a"
// lastIndexOf () doubt???? same should mention in a string "c" i will take the last alphabet if ccc last c
// slice() (it will show output only as last 5 words) (+ if we put , first 5 words will cut and output shows)
// substring () (substring means print the first words from 0-7 like chennai has 7 words)
// replace ()
// replace all ()
// trim () strarting and ending same remove
// split() seprate the words , part part
// join () join the words which we split (it will be join the slpitted words)
// concat () is used to connect one para to another para in the end
// startsWith () string starts with - only starting alphabet - its a boolean format - true or false
// endsWith () string ends with last - word - aplphabet - its a boolean format - true or false
// includes () checking whether the word is we given inside string is there or noe - true or flase
var a = "chennai city centre"
console.log(a.charAt(2));
console.log(a.indexOf("e"));
console.log(a.lastIndexOf("e"));
console.log(a.slice(-5));
console.log(a.substring(0,7));
console.log(a.replace("chennai","inox"));
console.log(a.replaceAll("e", "E"));
console.log(a.trim(""));
console.log(a.split(""). join (""));
console.log(a.concat(" nice to join"));
console.log(a.startsWith("c"));
console.log(a.endsWith("c"));
console.log(a.includes("b"));