-
Notifications
You must be signed in to change notification settings - Fork 1
/
string objectin js-2.html
37 lines (34 loc) · 1.36 KB
/
string objectin js-2.html
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
<html>
<body>
<script type="text/javascript">
var s1 = "hello";
var s2 = "hello";
var str = "Kamani Science";
var col = "Collage";
var fullname;
fullname = str.concat("", col);
/*document.write("Charactor at="+str.charAt(4)+"<br>");
document.write("Charactor at="+str.charAt(10)+"<br>");
document.write("concate string="+fullname+"<br>");
document.write("Index of string="+str.indexOf("a")+"<br>");
document.write("Index of string="+str.indexOf("n")+"<br>");
document.write("Index of string="+str.lastIndexOf("n")+"<br>");*/
if (s1.match(s2)) {
document.write("Match string");
}
else {
document.write("Not match");
}
document.write("string replace=" + str.replace("Kamani", "Pratapray") + "<br>");
document.write("search string=" + str.search("Kamani") + "<br>")
document.write("slice string=" + str.slice(0, 6) + "<br>");
document.write("slice string=" + fullname.slice(15, 22) + "<br>");
document.write("sub string=" + fullname.substring(7, 14) + "<br>");
document.write("sub string=" + fullname.substring(0, 14) + "<br>");
document.write("substr string=" + fullname.substr(0, 10) + "<br>");
document.write("substr string=" + fullname.substr(10, 2) + "<br>");
document.write("upper case value=" + fullname.toUpperCase() + "<br>");
document.write("lower case value=" + fullname.toLowerCase() + "<br>");
</script>
</body>
</html>