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:

(NSInteger i = 1; i <81; i ++) {if (! [Array1 contains the object: @ ( I)]} {{array2 addObject: @ (i)]; }}

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

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -