Is there any other way to replace besides the Replace () function?

In the c programming language,

I can do

printf("%d\n", value); 

But in C #, how can I do this? For example, the string "Good% s everyone"

I want to replace% s with a variable. Is there any solution other than

 str.Replace("%s","good morning"); 
+4
source share
1 answer

string.Format will be your pick function.

Then you can write, for example:

 const string t = "Thomas"; var s = string.Format("Good morning {0}.", t); 

With the replacement of {0} by the value of t .

+10
source

All Articles