Skip to main content
Put code in block reference to source of code
Source Link
Blindspots
  • 7.5k
  • 5
  • 20
  • 38

Thank you so much. It took this novice awhile to find this simple solution. Here'sI created a short function I created with it.from Rubén's solution:

function SpaceBuilder(spaces){  
    var mySpaces = ' ';  
    for(var nnn=1;nnn<spaces;nnn++){  
        mySpaces = mySpaces + ' ';  
    }  
    return mySpaces.replace(/ /g,'\xa0');  
}

Example:

var xxx = SpaceBuilder(5);
Ui.alert('Hello' + xxx + 'World')

var xxx = SpaceBuilder(5);  
Ui.alert('Hello' + xxx + 'World')

Results:

Hello     World

Thank you so much. It took this novice awhile to find this simple solution. Here's a short function I created with it.

function SpaceBuilder(spaces){  
    var mySpaces = ' ';  
    for(var nnn=1;nnn<spaces;nnn++){  
        mySpaces = mySpaces + ' ';  
    }  
    return mySpaces.replace(/ /g,'\xa0');  
}

Example:

var xxx = SpaceBuilder(5);
Ui.alert('Hello' + xxx + 'World')

Results:

Hello     World

I created a short function from Rubén's solution:

function SpaceBuilder(spaces){  
    var mySpaces = ' ';  
    for(var nnn=1;nnn<spaces;nnn++){  
        mySpaces = mySpaces + ' ';  
    }  
    return mySpaces.replace(/ /g,'\xa0');  
}

Example:

var xxx = SpaceBuilder(5);  
Ui.alert('Hello' + xxx + 'World')

Results:

Hello     World
added 19 characters in body
Source Link

Thank you so much. It took this novice awhile to find this simple solution. Here's a short function I created with it.

Thank you so much. It took this novice awhile to find this simple solution. Here's a short function I created with it.

function SpaceBuilder(spaces){ var mySpaces = ' '; for(var nnn=1;nnn<spaces;nnn++){ mySpaces = mySpaces + ' '; } return mySpaces.replace(/ /g,'\xa0'); }

function SpaceBuilder(spaces){  
    var mySpaces = ' ';  
    for(var nnn=1;nnn<spaces;nnn++){  
        mySpaces = mySpaces + ' ';  
    }  
    return mySpaces.replace(/ /g,'\xa0');  
}

Example:

var xxx = SpaceBuilder(5); 
Ui.alert('Hello' + xxx + 'World')

Results: Hello World

Hello     World

Thank you so much. It took this novice awhile to find this simple solution. Here's a short function I created with it.

function SpaceBuilder(spaces){ var mySpaces = ' '; for(var nnn=1;nnn<spaces;nnn++){ mySpaces = mySpaces + ' '; } return mySpaces.replace(/ /g,'\xa0'); }

Example:

var xxx = SpaceBuilder(5); Ui.alert('Hello' + xxx + 'World')

Results: Hello World

Thank you so much. It took this novice awhile to find this simple solution. Here's a short function I created with it.

function SpaceBuilder(spaces){  
    var mySpaces = ' ';  
    for(var nnn=1;nnn<spaces;nnn++){  
        mySpaces = mySpaces + ' ';  
    }  
    return mySpaces.replace(/ /g,'\xa0');  
}

Example:

var xxx = SpaceBuilder(5); 
Ui.alert('Hello' + xxx + 'World')

Results:

Hello     World
added 105 characters in body
Source Link

Thank you so much. It took this novice awhile to find this simple solution. Here's a short function I created with it.

function SpaceBuilder(spaces){ var mySpaces = ' '; for(var nnn=1;nnn<spaces;nnn++){ mySpaces = mySpaces + ' '; } return mySpaces.replace(/ /g,'\xa0'); }

Thank you so much. It took this novice awhile to find this simple solution. I now keep a variable handyExample: var my4Spaces

var xxx = ' '.replaceSpaceBuilder(/ /g,'\xa0'5);
!!! Except the draft of this comment doesn't show the four spaces!!! Anyway, I guess I could also create a loop function to create as many spaces as I desireUi.alert('Hello' + xxx + 'World')

Results: Hello World

Thank you so much. It took this novice awhile to find this simple solution. I now keep a variable handy: var my4Spaces = ' '.replace(/ /g,'\xa0');
!!! Except the draft of this comment doesn't show the four spaces!!! Anyway, I guess I could also create a loop function to create as many spaces as I desire.

Thank you so much. It took this novice awhile to find this simple solution. Here's a short function I created with it.

function SpaceBuilder(spaces){ var mySpaces = ' '; for(var nnn=1;nnn<spaces;nnn++){ mySpaces = mySpaces + ' '; } return mySpaces.replace(/ /g,'\xa0'); }

Example:

var xxx = SpaceBuilder(5); Ui.alert('Hello' + xxx + 'World')

Results: Hello World

Source Link
Loading