> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# NextGroup Method of the Text Object

This method returns the index of the next character in the text, which has the selected parameters different from such parameters of the character specified.

For example, if you set the value of the *Mask* parameter to CFL\_Suspicious (which means that the [**ICharParams::IsSuspicious**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/charparams.md#issuspicious) property should be taken into account) and the character with the *Pos* index is not suspicious, the method will return the index of the next suspicious character, and vice versa if the character with the *Pos* index is suspicious, the method will return the index of the next character, which is not suspicious.

## Syntax

```vb Visual Basic .NET theme={null}
Function NextGroup( _
  Pos  As Integer, _
  Mask As Integer _
) As Integer
```

```cpp C++ theme={null}
HRESULT NextGroup(
  int  Pos,
  int  Mask,
  int* Result
);
```

## Parameters

**Pos**

\[in] This variable contains the index of the character, which defines parameters of the search for the next character.

**Mask**

\[in] This variable contains any OR combination of the [**CharParamsFlags**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/charparamsflags.md) flags. It defines what character parameters are taken into account when searching for the next character.

**Result**

\[out, retval] A pointer to an **int** variable that receives the position of the next character, which has the selected parameters different from such parameters of the character with the *Pos* index. If the next character is not found, the length of the paragraph is returned.

## Return values

This method has no specific return values. It returns the [standard return values of ABBYY FlexiCapture SDK functions](https://docs.abbyy.com/flexi-capture/sdk/api-reference/errorcodes.md).

## See also

[**Text**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/text.md)

[**CharParamsFlags**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/charparamsflags.md)
