static void Main(string[] args)
{
string str_val = "8584348,894";
//int prefix = Convert.ToInt32(str_val[0]); //prefix = 56 O_o
//int prefix = (int)str_val[0]; //what, again 56? i need 8!
int prefix = Convert.ToInt32("8"); //at least this works -_-
}
任何想法如何将第一个符号转换为正确的数值?尝试将字符串的第一个符号转换为int,得到奇怪的值
它发现字符的ascii值,而不是你想知道的情况。 – Bridge 2012-07-26 13:16:00
感谢您解释这个! – Kosmos 2012-07-26 13:24:06