2014-01-27 111 views
0

我有一個字符串一個很長的字符串我希望把變量intoit但我不能如何把變量放入一個長字符串

string body = @"-----------------------------13254316446590 
Content-Disposition: form-data; name=""max_file_size"" 

100000 
-----------------------------13254316446590 
Content-Disposition: form-data; name=""uploadedfile""; filename=""file.txt"" 
Content-Type: application/octet-stream 

<!>C:\Users\anton\AppData\Local\Temp\lost\file.txt<!> 
-----------------------------13254316446590-- 
"; 

我想要的路徑和文件名變量 我知道這看起來像一個愚蠢的問題,但我試圖把「」+「」沒有成功

+0

「我有一個字符串」這聽起來像我有一個夢想:) – user1863359

回答

1

你試過用String.Format(...)http://msdn.microsoft.com/en-us/library/system.string.format%28v=vs.110%29.aspx

例子:

DateTime dat = new DateTime(2012, 1, 17, 9, 30, 0); 
string city = "Chicago"; 
int temp = -16; 
string output = String.Format("At {0} in {1}, the temperature was {2} degrees.", 
           dat, city, temp); 
Console.WriteLine(output); 
// The example displays the following output: 
// At 1/17/2012 9:30:00 AM in Chicago, the temperature was -16 degrees. 
1

嘗試String.Format()

String.Format("some string {0} other string {1}", path, filename); 

MSDN Article,它可以幫助你。

相關問題