> For the complete documentation index, see [llms.txt](https://docs.wisej.com/ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wisej.com/ai/components/api/services/itextsplitterservice.md).

# ITextSplitterService

Namespace: **Wisej.AI.Services**

Assembly: **Wisej.AI** (3.5.0.0)

Represents a service for splitting text into an array of substrings.

{% tabs %}
{% tab title="C#" %}

```csharp
public interface ITextSplitterService
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Interface ITextSplitterService
```

{% endtab %}
{% endtabs %}

This interface defines a contract for text splitting services. The primary function is to take a single piece of text and split it into an array of substrings based on a specific implementation-defined criterion.\
Implementations of this interface may use different strategies for splitting, such as splitting by spaces, punctuation, or custom delimiters.

## Methods

### ![](/files/ptrKjmmRoQB76pvrIqh0) Split(text)

Splits the specified text into an array of substrings.

| Parameter | Type                                                          | Description                                                                    |
| --------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| **text**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to split into substrings. This parameter should not be null or empty. |

**Returns:** [String\[\]](https://docs.microsoft.com/dotnet/api/system.string). An array of substrings derived from the *text* .

This method processes the input text according to the splitting logic defined by the implementation. The result is an array where each element is a substring of the original text.\
Example usage:

```csharp

  ITextSplitterService splitterService = new SimpleTextSplitterService();
  string[] words = splitterService.Split("This is a sample text.");
  // words: ["This", "is", "a", "sample", "text."]

```

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when the *text* is null.

## Implemented By

| Name                                                                                                                                                 | Description                                                                                                                                                                                                        |
| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [RecursiveCharacterTextSplitterService](/ai/components/api/services/itextsplitterservice/wisej.ai.services.recursivecharactertextsplitterservice.md) | A service for recursively splitting text into chunks based on specified separators and chunk size constraints. This service attempts to split text by different characters to find an optimal separation strategy. |
| [TextSplitterServiceBase](/ai/components/api/services/itextsplitterservice/wisej.ai.services.textsplitterservicebase.md)                             | Provides the base functionality for text splitting services, allowing subclasses to define custom splitting logic.                                                                                                 |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.wisej.com/ai/components/api/services/itextsplitterservice.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
