Nodejs Utililty Methods String Case Convert

List of utility methods to do String Case Convert

Description

The list of methods to do String Case Convert are organized into topic(s).

Method

toAkaLowerCase()
String.prototype.toAkaLowerCase = function() {
    var integer=0,i;
    var newString="";
    for(i=0;i<this.length;i++){
      var integer = this.charCodeAt(i);
      if(integer>=65 && integer<=90){
        integer=integer+32;
        newString=newString+String.fromCharCode(integer);
      else{
        newString=newString+String.fromCharCode(integer);
    return newString;
  };
toAkaUpperCase()
String.prototype.toAkaUpperCase = function() {
  var integer=0,i;
  var newString="";
  for(i=0;i<this.length;i++){
    var integer = this.charCodeAt(i);
    if(integer>=97 && integer<=122){
      integer=integer-32;
      newString=newString+String.fromCharCode(integer);
    else{
      newString=newString+String.fromCharCode(integer);
  return newString;
};
toAlternatingCase()
String.prototype.toAlternatingCase = function() {
  return [...this].map(
    (c) => (c === c.toUpperCase() ? c.toLowerCase() : c.toUpperCase()),
  ).join``;
};
toAlternatingCase()
String.prototype.toAlternatingCase = function () {
  var _str = ""; 
  for(var _c = 0; _c < this.length; _c++){
    _str += ((this[_c] === this[_c].toUpperCase())? this[_c].toLowerCase() : this[_c].toUpperCase());
  return _str;
toAlternatingCase()
String.prototype.toAlternatingCase = function () {
  var result = [];
  var letters = this.split("");
  letters.forEach(function(char) {
    if ((char.charCodeAt(0) >= 97) && (char.charCodeAt(0) <= 122)) {
      result.push(char.toUpperCase());
    } else if ((char.charCodeAt(0) >= 65) && (char.charCodeAt(0) <= 90)){
      result.push(char.toLowerCase());
    } else {
...
toAlternatingCase()
String.prototype.toAlternatingCase = function () {
  var newStr = "";
  for (var i = 0; i < this.length; i++){
    if (this.charAt(i).toUpperCase() === this.charAt(i)){
       newStr += this.charAt(i).toLowerCase();
    } else {
       newStr += this.charAt(i).toUpperCase();  
  return newStr;
toAlternatingCase()
String.prototype.toAlternatingCase = function () {
  return this.toString().split('')
                        .map(l => l.match(/[a-z]/)  ? l.toUpperCase() : l.toLowerCase())
                        .join('');
toAlternatingCase()
String.prototype.toAlternatingCase = function() {
  var output = '';
  for (var i=0; i<this.length; i++) {
    if (this[i].toLowerCase() === this[i]) {
      output = output + this[i].toUpperCase();
    } else if (this[i].toUpperCase() === this[i]) {
      output = output + this[i].toLowerCase();
    } else {
      output = output + this[i];
...
snakeCase()
String.prototype.snakeCase = function() {
  return this.replace( /([A-Z])/g, function( $1 ) {return "_" + $1.toLowerCase();} );
};
snakeCaseDash()
String.prototype.snakeCaseDash = function() {
  return this.replace( /([A-Z])/g, function( $1 ) {return "-" + $1.toLowerCase();} );
};