Question : js replace space with underscore
Answered by : kees-van-beilen
var string = "my name";
string = string.replace(/ /g,"_"); //returns my_name
Source : | Last Update : Fri, 01 May 20
Question : javascript replace space by underscore
Answered by : vastemonde
// replaces space with '_'
str = str.replace(/ /g, "_");
// or
str = str.split(' ').join('_');
Source : | Last Update : Tue, 18 May 21
Question : replace underscore with space in js
Answered by : shehroze-ali
str.replace(/_/g, ' ');
Source : https://stackoverflow.com/questions/11810569/how-to-replace-underscores-with-spaces | Last Update : Fri, 30 Dec 22
Question : replace spaces with underscores vbnet
Answered by : joel-cunningham
MyString = MyString.Replace(" ", "_")
Source : | Last Update : Thu, 06 Jan 22
Question : replace underscore with space
Answered by : you
string_with_underscore = "hello_world"
string_with_space = string_with_underscore.replace("_", " ")
print(string_with_space)
Source : | Last Update : Tue, 19 Sep 23
Question : replace spaces with underscores in an array javascript
Answered by : richard-lievesley
var my_array = ['text one', 'text two', 'text three']
console.log(my_array) // Prints normally.
my_array = spacesToUnderscores(my_array)
console.log(my_array) // Now all strings have underscores instead of spaces.
function spacesToUnderscores(arr)
{ for(let i=0; i<=arr.length-1; i++) arr[i] = arr[i].replace(' ', '_') return arr
}
Source : | Last Update : Wed, 28 Sep 22