Please answer and explain.
String.Format(“Input = {0} and Output = {1}”, “1”,”2”)
Please answer and explain.
String.Format(“Input = {0} and Output = {1}”, “1”,”2”)
Hi @kkasegaonkar
Please refer to this post:
Hope this helps.
Thanks and regards.
Despi
its string formatting buddy @kkasegaonkar
like {0} and {1} are termed as placeholders
[ String.Format(“Input = {0} and Output = {1}”, “1”,”2”) ]
and “1”,“2” are the values that are going to be placed in that placeholders
[String.Format(“Input = {0} and Output = {1}”, “1”,”2”)]
and the output would be like this buddy
for example we have string variable like this
in_text = “hi my {0} is {1}”
now
in_text = in_text.ToString.Format({0},{1},“name”,“kkasegaonkar”)
now the output would be
hi my name is kkasegaonkar
like wise for this
Input = 1 and Output = 2
thats all buddy simple @kkasegaonkar
Hope this would help you
Cheers
This is a good question while working with string operation. String.Format() Method is used to insert the value of variable or an object or expression into another string. using string Format method, we can replace the format items in the specified string with the string representation of specified objects.
Here {0} and {1} are place holders for string format methods.
The String.Format(“Input = {0} and Output = {1}”, “1”,”2”) expression returns the following text:
Anwser:
Input = 1 and Output = 1
Please check this link for more info: C# String Format Method - Tutlane
Thanks,
Arunachalam.
Thanks a ton, @Arunachalam. It helped a lot.
Thanks a lot @Palaniyappan
Input =1 and Output =2 is the answer
Good . Can you please mark as your valuable solution so that our folks can get the info on this window
Thanks,
Arunachalam.
Fantastic buddy @kkasegaonkar
Cheers
keep going
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.