ios - I want to populate an array2 with values from 1 to 100, but leaving values which are present in array1 -
I want to populate array2 with values from 1 to 100, but except the values that are present in array1, Array1 sort Can not be done.
For example: if array1 [2,8,3], I want array2 to be [1,4,5,6,7,9,10,11 .... 98,99,100].
If I correctly understand what you are trying to achieve , This code snippet will resolve the problem:
It will basically repeat from 1 to 100 and see if the current number is merged into array1 - if not, then this number should be numbered in arrayn (If you need a string as your original code, use [NSString stringWithFormat: @ "% d", i]
).
Comments
Post a Comment