xxxxxxxxxx
var string = "my name";
string = string.replace(/ /g,"_"); //returns my_name
xxxxxxxxxx
using System;
class Demo {
static void Main() {
String str, str2;
str ="Hello World !";
Console.WriteLine("String: "+str);
str2 = str.Replace(" ", "-");
Console.WriteLine("String (After replacing): "+str2);
}
}
xxxxxxxxxx
string_with_underscore = "hello_world"
string_with_space = string_with_underscore.replace("_", " ")
print(string_with_space)