---
title: "consuming(_:startingAt:in:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/decimal/formatstyle/percent/consuming(_:startingat:in:)"
---

# consuming(_:startingAt:in:)

Process the input string within the specified bounds, beginning at the given index, and return the end position (upper bound) of the match and the produced output.

## Declaration

```swift
func consuming(_ input: String, startingAt index: String.Index, in bounds: Range<String.Index>) throws -> (upperBound: String.Index, output: Decimal)?
```

## Parameters

- `input`: An input string to match against.
- `index`: The index within input at which to begin searching.
- `bounds`: The bounds within input in which to search.

## Return Value

Return Value The upper bound where the match terminates and a matched instance, or nil if there isn’t a match.
