2013-10-11 71 views
-4

就像C++中CString類型的GetAt方法一樣,c#中的等價函數是如何在字符串中的特定索引處獲取字符?獲取字符串中特定索引的字符c#

+0

ATLEAST證明downvote! –

+2

你應該做的最小努力之前張貼:http://stackoverflow.com/questions/3581741/c-sharp-equivalent-to-javas-charat – fmgp

+0

這種問題,你應該只是谷歌:/ –

回答

2
string myString = "HelloWorld"; 
char myChar = myString[index]; 
0

如何

string result = mystring[myindex].ToString(); 
0

對待字符串數組。

var testString = "blah"; 
Console.WriteLine(testString[2]); 

寫...

a 
0

與數組一樣:

var s = "hello"; 
var ch = s[0]; // ch == 'h' 
相關問題