# Text prefix suffix check

`text-prefix-suffix-check` · version 1.0.0 · Text · free, no key needed

Exact prefix and/or suffix boolean checks using JS string startsWith/endsWith.

**Use when you need to: text prefix check · text suffix check · starts with.**

## Supported

- text prefix check
- text suffix check
- starts with
- ends with

## Not supported

- case insensitive
- grapheme
- locale
- regex

## Behavior

- At least one of prefix or suffix must be present.
- Uses String.prototype.startsWith / endsWith (UTF-16 code units).
- Empty prefix or empty suffix is true for any text.
- A needle longer than text is false.
- Returned object includes starts_with only when prefix was supplied, ends_with only when suffix was supplied.
- No case folding, locale collation, grapheme segmentation, or regular expressions.

## Input

- `text` (string, required): max length 256000
- `prefix` (string, optional): max length 256000
- `suffix` (string, optional): max length 256000

## Output

- `starts_with` (boolean, optional)
- `ends_with` (boolean, optional)

## Limits

- max input bytes: 256000

## Example

Request input:

```json
{
  "text": "ComputeFirst",
  "prefix": "Compute",
  "suffix": "First"
}
```

Response:

```json
{
  "result": {
    "starts_with": true,
    "ends_with": true
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "text-prefix-suffix-check",
  "version": "1.0.0",
  "input": {
    "text": "ComputeFirst",
    "prefix": "Compute",
    "suffix": "First"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/text-prefix-suffix-check/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"text":"ComputeFirst","prefix":"Compute","suffix":"First"}'
```

The machine-readable contract is at [/v1/tools/text-prefix-suffix-check/versions/1.0.0](/v1/tools/text-prefix-suffix-check/versions/1.0.0).

### CLI

```sh
node cli.mjs run text-prefix-suffix-check 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Text indentation detect](/tools/text-indentation-detect): Detect whether a text uses tabs or spaces for indentation by counting lines.
- [Text tabs to spaces](/tools/text-tabs-to-spaces): Convert tab characters to spaces.
- [Text three way merge](/tools/text-three-way-merge): Three-way merge of text line records with merge or diff3 conflict markers.
- [Text unicode normalization check](/tools/text-unicode-normalization-check): Check if a text string is in various Unicode normalization forms (NFC, NFD, NFKC, NFKD).
- [Text apply unified patch](/tools/text-apply-unified-patch): Apply a one-file unified patch to text at original line addresses with exact hunk matches.
- [Text conflict parse](/tools/text-conflict-parse): Parse merge or diff3 conflict-marker text into ordered text and conflict parts.
