Title: Theory / Important / CS / Programming / Objective-C / Library / NS / Collection / Range
Tags: automatedNewLineAfterCommaSpace
On every note of this deck, unless a note says otherwise:
Page: https://developer.apple.com/documentation/foundation/nsrange?language=objc

Typ: NSRange
Meaning: A structure used to describe a portion of a series, such as characters in a string or objects in an array.1
Page: https://developer.apple.com/documentation/foundation/nsrange?language=objc
Language: Objective-C

Instruction: NSEqualRanges(
  NSRange range1,
  NSRange range2
)
Language: Objective-C
Returns: Whether range1 and range2 has the same locations and lengths
Variables: NSRange range
Typ: NSRange

Instruction: NSIntersectionRange(
  NSRange range1,
  NSRange range2
)
Language: Objective-C
Returns: The intersection of range1 and range2. If it is empty, then its location is not defined
Variables: NSRange range
Typ: NSRange

Instruction: NSLocationInRange(
  loc,
  range
)
Language: Objective-C
Returns: whether loc belongs to range
Variables: NSRange range
Typ: NSRange

Instruction: NSMakeRange(
  loc,
  len
)
Language: Objective-C
Returns: A range, whose first element is loc of length len
Variables: NSRange range
Typ: NSRange

Instruction: NSMaxRange(
  loc,
  len
)
Language: Objective-C
Returns: The first element after the range
Variables: NSRange range
Assuming: range not empty
Typ: NSRange

Instruction: NSRangeFromString(string)
Language: Objective-C
Returns: A range with start location and length as in the pair encoded in string
Typ: NSRange

Variable: range.location
Meaning: The first element of the range
Page: https://developer.apple.com/documentation/foundation/nsrange?language=objc
Language: Objective-C
Typ: NSRange
Variables: NSRange range
Assuming: Range is not empty

Variable: range.length
Meaning: The length of the range
Page: https://developer.apple.com/documentation/foundation/nsrange?language=objc
Language: Objective-C
Typ: NSRange
Variables: NSRange range

Instruction: NSUnionRange(
  range1,
  range2
)
Language: Objective-C
Returns: The smallest range containing range 1 and range2. I.e. both ranges and elements in between
Variables: NSRange range
Typ: NSRange

Typ: NSRangePointer
Meaning: NSRange*
Page: https://developer.apple.com/documentation/foundation/nsrange?language=objc
Language: Objective-C

Variable: NSNotFound
Meaning: A value indicating that a requested item couldn’t be found or doesn’t exist.
Page: https://developer.apple.com/documentation/foundation/nsrange?language=objc
Context: Range
Language: Objective-C