comparing arrays in objective-c

前端 未结 5 1963
梦谈多话
梦谈多话 2020-12-09 11:24

Ok a pretty simple question.. in c++ it seems to work but in objective-c i seem to struggle with it :S .. If you want to compare two arrays it should be something like thi

5条回答
  •  伪装坚强ぢ
    2020-12-09 12:05

    You want the isEqualToArray: method. As in:

    if ([arrayOne isEqualToArray:arrayTwo]) {
      // Do something
    }
    

    This will recursively compare the two arrays, while having the advantage of not being needlessly circuitous and not requiring a loop.

提交回复
热议问题