Nodejs Utililty Methods String Char Set

List of utility methods to do String Char Set

Description

The list of methods to do String Char Set are organized into topic(s).

Method

setCharAt(index, ch)
String.prototype.setCharAt = function (index, ch){
    if (index > this.length || index < 0) return this;
    return this.substring(0, index) + ch + this.substring(index+1);
function sortLetter(str){
    for (var i = 0; i < str.length; i++)
        for (var j = i+1; j < str.length; j++)
            if (str.charCodeAt(i) > str.charCodeAt(j)){
                var t = str.charAt(i);
...
setCharAt(index, ch)
String.prototype.setCharAt = function (index, ch){
    if (index > this.length || index < 0) return this;
    return this.substring(0, index) + ch + this.substring(index+1);
function convert(str){
    str = ' ' + str;
    var i = 0;
    while (i < str.length){
        i++;
...
setCharAt(index, newValue)
String.prototype.setCharAt = function (index, newValue) {
  return this.substring(0, index) + newValue + this.substring(index+1, this.length);
};
setCharAt(index,chr)
String.prototype.setCharAt = function(index,chr) {
  if(index > this.length-1) return str;
  return this.substr(0,index) + chr + this.substr(index+1);
setCharAt(index,chr)
String.prototype.setCharAt = function(index,chr) { 
  if(index > this.length-1) return this;
  return this.substr(0,index) + chr + this.substr(index+1);