一般的英文轉數字
int a = (int)"A";
用於Excel將英文欄位轉換成對應的數值
private int Column(string str)
{
char[] arr = str.ToCharArray();
int column = 0;
if (arr.Length == 1)
{
column = (int)arr[0] - 65 + 1;
}
else if (arr.Length == 2)
{
column = ((int)arr[0] - 65 + 1) * 26 + (int)arr[1] - 65 + 1;
}
return column;
}