 
   /// Returns by reference the beginning of the first line and
   /// the end of the last line touched by the given range.
-  public func getLineStart(
+  public func getLineStart<
+    R : RangeExpression
+  >(
     _ start: UnsafeMutablePointer<Index>,
     end: UnsafeMutablePointer<Index>,
     contentsEnd: UnsafeMutablePointer<Index>,
-    for range: Range<Index>
-  ) {
+    for range: R
+  ) where R.Bound == Index {
     _withOptionalOutParameter(start) {
       start in self._withOptionalOutParameter(end) {
         end in self._withOptionalOutParameter(contentsEnd) {
           contentsEnd in self._ns.getLineStart(
             start, end: end,
             contentsEnd: contentsEnd,
-            for: _toNSRange(range))
+            for: _toNSRange(range.relative(to: self)))
         }
       }
     }

  /// Returns a new string made by replacing in the `String`
  /// all percent escapes with the matching characters as determined
  /// by a given encoding.
  @available(swift, deprecated: 3.2, obsoleted: 4.0,
    message: "Use removingPercentEncoding instead, which always uses the recommended UTF-8 encoding.")
  public func replacingPercentEscapes(
    using encoding: String.Encoding

  /// enumerating the specific range of the string, providing the
  /// Block with the located tags.
  public func enumerateLinguisticTags<
    T : StringProtocol, R : RangeExpression
  >(
    in range: R,
    scheme tagScheme: T,
    options opts: NSLinguisticTagger.Options = [],
    orthography: NSOrthography? = nil,
    invoking body:
      (String, Range<Index>, Range<Index>, inout Bool) -> Void
  ) where R.Bound == Index {
    let range = range.relative(to: self)
    _ns.enumerateLinguisticTags(
      in: _toNSRange(range),
      scheme: tagScheme._ephemeralString,
