How to turn an NSArray of strings into an array of unique strings, in the same order?

前端 未结 5 1983
我在风中等你
我在风中等你 2020-12-23 17:34

If you have an NSArray of strings

{ @\"ONE\", @\"ONE\", @\"ONE\", \"TWO\", @\"THREE\", @\"THREE\" }

How would I turn that into

<         


        
5条回答
  •  醉梦人生
    2020-12-23 17:58

    I Think You can Do this With that

    NSArray * uniqueArray = [[Yourarray valueForKeyPath:@"@distinctUnionOfObjects.self"] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
    

    i hope this would help you

提交回复
热议问题