-3
我需要幫助。試圖從字符串中取出第二個字符時,我該怎麼做?我想從字符串中取出一個字符
// read in a string from the user in the following format:
//pyramid slot number, block letter, whether or not the block should be lit
Console.Write("Enter slot number, block letter & if the block should be lit or not (y/n)");
string csvString = Console.ReadLine();
// find comma location
int commaLocation = csvString.IndexOf(',');
// extract slot number
int slotnumber = int.Parse(csvString.Substring(0,commaLocation));
// Print slot number
Console.WriteLine("Slot number: " + slotnumber);
// extract block letter
*string blockletter = string.ConvertToChar(csvString.Substring(commaLocation + 1));*
// print block letter
Console.WriteLine("Block letter: " + blockletter);
你必須在ascii值混淆? –