Nodejs String Replace replaceAll( searchStr, replaceStr )

Here you can find the source of replaceAll( searchStr, replaceStr )

Method Source Code

String.prototype.replaceAll = function( searchStr, replaceStr ) {
    var temp = this;

    while( temp.indexOf( searchStr ) != -1 ){
        temp = temp.replace( searchStr, replaceStr );
    }//from  w  w  w  .  j  av a2s. c  o  m
    return temp;
}

Related

  1. replaceAll
    ===
    
  2. replaceAll(
    String.prototype.replaceAll = function( 
      strTarget,
      strSubString
      ){
        var strText = this;
        var intIndexOfMatch = strText.indexOf( strTarget );
        while (intIndexOfMatch != -1)
          strText = strText.replace( strTarget, strSubString )
    ...
    
  3. replaceAll( token, newToken, ignoreCase )
    String.prototype.replaceAll = function( token, newToken, ignoreCase ) {
        var _token;
        var str = this + "";
        var i = -1;
        if ( typeof token === "string" ) {
            if ( ignoreCase ) {
                _token = token.toLowerCase();
                while( (
                    i = str.toLowerCase().indexOf(
    ...
    
  4. replaceAll( token, newToken, ignoreCase )
    String.prototype.replaceAll = function( token, newToken, ignoreCase ) {
        var _token;
        var str = this + "";
        var i = -1;
        if ( typeof token === "string" ) {
            if ( ignoreCase ) {
                _token = token.toLowerCase();
                while( (
                    i = str.toLowerCase().indexOf(
    ...
    
  5. replaceAll( token, newToken, ignoreCase )
    String.prototype.replaceAll = function( token, newToken, ignoreCase ) {
        var _token;
        var str = this + "";
        var i = -1;
        if ( typeof token === "string" ) {
            if ( ignoreCase ) {
                _token = token.toLowerCase();
                while( (
                    i = str.toLowerCase().indexOf(
    ...
    
  6. replaceAll( token, newToken, ignoreCase )
    String.prototype.replaceAll = function( token, newToken, ignoreCase ) {
        var _token;
        var str = this + "";
        var i = -1;
        if ( typeof token === "string" ) {
            if ( ignoreCase ) {
                _token = token.toLowerCase();
                while( (
                    i = str.toLowerCase().indexOf(
    ...