This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "use strict"; | |
| /* | |
| Example Usage: node strncasecmp.js "Some String" "Some String" 5 | |
| */ | |
| String.prototype.strncasecmp = function(str , len) { | |
| let lowerThis = this.substr(0,len).toLowerCase(); | |
| let lowerStr = str.substr(0,len).toLowerCase(); | |
| return lowerThis>lowerStr ? 1 : (lowerThis<lowerStr ? -1 : 0); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "use strict"; | |
| String.prototype.strcasecmp = function(str) { | |
| let lowerThis = this.toLowerCase(); | |
| let lowerStr = str.toLowerCase(); | |
| return lowerThis>lowerStr ? 1 : (lowerThis<lowerStr ? -1 : 0); | |
| }; | |
| //Code below this point is only required to test via command line. | |
| if (typeof process !== "undefined") { | |
| const args = process.argv; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "use strict"; | |
| String.prototype.strcmp = function(str) { | |
| return this>str ? 1 : (this<str ? -1 : 0); | |
| } | |
| //Code below this point is only required to test via command line. | |
| if (typeof process !== "undefined") { | |
| const args = process.argv; | |
| const nodeLocation = args[ 0 ]; | |
| const myfileName = args[ 1 ]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "use strict"; | |
| /* | |
| Node Usage: node brackets.js "{[asd]}" "(test)" "[{UNBALANCED)]" | |
| */ | |
| String.prototype.validateBrackets = function () { | |
| let allBrackets = "{}[]()", | |
| bracketStack = [], | |
| //Length of string | |
| len = this.length, | |
| indx,//index of char |