How to provide custom string placeholder for string format

后端 未结 8 2188
借酒劲吻你
借酒劲吻你 2020-12-24 07:15

I have a string

string str =\"Enter {0} patient name\";

I am using string.format to format it.

String.Format(str, \"Hello\         


        
8条回答
  •  悲哀的现实
    2020-12-24 07:44

    object[] myInts = new int[] {8,9}; 
    

    However you can get away with:

    object[] myInts = new string[] { "8", "9" }; 
    string bar = string.Format("{0} {1}", myInts); 
    

提交回复
热议问题