I am trying to find the intersection of 2 number ranges, say for example…
range A is from 10 to 100,
range B is from 60 to 70
Is there an easy way without writing a load of if statements to calculate the intersection of the two ranges, so in this example it would be 10.
Thanks,
If you have or make
NSRangeobjects, the NSIntersectionRange function will do this for you. Just be sure to check what it returns when there is no intersection.