Monotouch (C#) equivalent to rangeOfCharacterFromSet

By : Luke

I'm trying to port some Objective-C code into C# - Code can be found here and it uses NSString's :rangeOfCharacterFromSet more than once.

As far as I understand, :rangeOfCharacterFromSet returns a subset of the string based on what options you pass in. Apple docs here will explain it better.

Is there a Monotouch binding that I'm missing? (I had a quick check of the rosetta and couldnt find it) Or is there an alternative C# approach I should be taking?

By : Luke


That is almost the same as String.IndexOfAny. rangeOfCharacterFromSet just returns the a range for the index of the first character it finds from your set of characters. String.IndexOfAny takes a character array and tells you the first index it finds for any of those characters.

By : Clancey

This video can help you solving your question :)
By: admin