How do I Compare two char[] arrays for equivalency?

前端 未结 5 422
眼角桃花
眼角桃花 2021-01-14 05:52

Right now, I have two char arrays, foo1[] and foo2[]. When I convert them to string and output to the console, they BOTH appear as

5条回答
  •  广开言路
    2021-01-14 06:17

    string s = new string(foo1);
    string t = new string(foo2);
    
    int c = string.Compare(s, t);
    if(c==0){
        //its equal
    }
    

提交回复
热议问题