<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSAttributedStringMarkdownSourcePosition/rangeInString:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSAttributedStringMarkdownSourcePosition(im)rangeInString:"
  },
  "title" : "rangeInString:"
}
-->

# rangeInString:

Returns a range indicating the source portion within a Markdown string.

```
- (NSRange) rangeInString:(NSString *) string;
```

## Parameters

`string`

The Markdown source string that this source position object refers to.

## Return Value

A range that represents the source portion within a source Markdown string.

## Discussion

Use this method to access the marked-up region of `string` with an NSRange, rather than making manual calculations based on row and column values.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)