-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值混淆? –