I'm looking for the php sprintf function for C # equivalent.
I have a string string:
"% s is a hit,% s is an exact match." I think that % s should be replaced with numbers that return the query. In PHP I would have been at the following location: $ res = sprintf ("% s is hit,% s is an exact match", $ number1, $ number2); How do I do this in C #? I had thought about the string.replace () , but it would only work with a piece that should be replaced. There are many in this case.
Looking for you:
string myStr = String Format ("{0} are hits, {1} is an exact match", number 1, number 2); The format specifier is slightly different than PHP.
Comments
Post a Comment