【发布时间】:2016-11-07 19:18:51
【问题描述】:
我在这里需要帮助。尝试从字符串中取出第二个字符时我做错了什么?
// 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值一定是混淆了?