“Ganti fungsi” Kode Jawaban

ganti string

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
PrashantUnity

Ganti fungsi

#replace(a,b) is the function which can replace the 'abc' word to 'klmn' word
example
a=input(' sentence :')
b=input(' word to be replaced :')
c=input(' word to be replaced with :')
d=a.replace(b,c)
print(d)
#output:
'''
sentence :richard play with pixis and natasha, rahim play along johan,rosel and ethan 
word to be replaced :play
word to be replaced with :go
richard go with pixis and natasha, rahim go along johan,rosel and ethan 
'''
Gr@Y_orphan_ViLL@in##

Ganti fungsi

const myText = 'The weather is cold';
const newString = myText.replace('cold', 'warm');
console.log(newString); // Should print "The weather is warm"
// the replace() string function takes a string,
// replaces one substring with another, and returns
// a new string with the replacement made
Concerned Curlew

Jawaban yang mirip dengan “Ganti fungsi”

Pertanyaan yang mirip dengan “Ganti fungsi”

Lebih banyak jawaban terkait untuk “Ganti fungsi” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya