JavaScript Zastąp ciąg
var str = "JavaScript replace method test";
var res = str.replace("test", "success");
//res = Javscript replace method success
Batman
var str = "JavaScript replace method test";
var res = str.replace("test", "success");
//res = Javscript replace method success
var str = "Original string!";
var str = str.replace("Original", "New");
var str = "That is like so not cool, I was like totally mad.";
var cleanStr = str.replace(/like/g, "");//replace every "like" with blank ""
var res = str.replace("find", "replace");
public static void main(String args[]){
String s1="my name is khan my name is java";
String replaceString=s1.replace("is","was");//replaces all occurrences of "is" to "was"
System.out.println(replaceString);
}}
string a = "String";
string b = a.Replace("i", "o"); // Strong
b = a.Insert(0, "My "); // My String
b = a.Remove(0, 3); // ing
b = a.Substring(0, 3); // Str
b = a.ToUpper(); // STRING
int i = a.Length; // 6