-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTest.js
37 lines (31 loc) · 1.35 KB
/
Test.js
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
//String test
//trim
var demo=function(){
var trimString = " hello this //nice world ";
var formateString="Hi {0} good{1}";
var replceString="Cow cow cow dog Dog dog";
return {
trimString:trimString,
trim : trimString.trim(),
trimEnd:trimString.trimEnd(),
trimStart:trimString.trimStart(),
formateString:formateString,
format:formateString.format("anik","morning"),
reverse:trimString.reverse(),
replceString: replceString,
replaceAll: replceString.replaceAll("cow","dog"),
replaceAllCaseSensitive: replceString.replaceAll("cow","dog",true),
removeSubsString:replceString.removeSubsString("dog"),
removeSubsStringCaseSensitive:replceString.removeSubsString("dog",true),
removeByStatingIndexNumer: replceString.removeByForwardingIndexNumerAndLength(12),
removeByStatingIndexNumerAndLength: replceString.removeByForwardingIndexNumerAndLength(12,6),
removeByBackwardingIndexNumer: replceString.removeByBackwardingIndexNumerAndLength(3),
removeByBackwardingIndexNumerAndLength: replceString.removeByBackwardingIndexNumerAndLength(3,4),
}
}();
for (name in demo) {
if (typeof demo[name] !== 'function') {
document.write("<strong>"+name+"</strong>" + '::' + "<u>"+demo[name]+"</u>");
document.write("<br>");
}
}