字符串转化为数字做异或,谁帮帮忙
string a="0001100";转化为数字后就变成了1100了,改怎么弄啊,一定要数字,因为后面要做异或运算,谁帮帮忙,谢谢
using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication19 { class Program { static void Main(string[] args) { string a = "0001100"; char combine; char[] c = a.ToCharArray(); Array.Reverse(c); for(int i=0;i<c.Length;i++) { if (c[i] == 0) { continue; } else if (c[i] == 1) { combine &= 1 << c[i]; } else { break; } } Console.Read(); } } }