# startsWith

> This document is the Markdown version of [valibot.dev/api/startsWith/](https://valibot.dev/api/startsWith/). For the complete documentation index, see [llms.txt](https://valibot.dev/llms.txt).

Creates a starts with validation action.

```ts
const Action = v.startsWith<TInput, TRequirement, TMessage>(
  requirement,
  message
);
```

## Generics

- `TInput` `extends string`
- `TRequirement` `extends string`
- `TMessage` `extends ErrorMessage<StartsWithIssue<TInput, TRequirement>> | undefined`

## Parameters

- `requirement` `TRequirement`
- `message` `TMessage`

### Explanation

With `startsWith` you can validate the start of a string. If the start does not match the `requirement`, you can use `message` to customize the error message.

## Returns

- `Action` `StartsWithAction<TInput, TRequirement, TMessage>`

## Examples

The following examples show how `startsWith` can be used.

### HTTPS URL schema

Schema to validate a HTTPS URL.

```ts
const HttpsUrlSchema = v.pipe(v.string(), v.url(), v.startsWith('https://'));
```

## Related

The following APIs can be combined with `startsWith`.

### Schemas

[`any`](/api/any.md), [`custom`](/api/custom.md), [`string`](/api/string.md)

### Methods

[`pipe`](/api/pipe.md)

### Utils

[`isOfKind`](/api/isOfKind.md), [`isOfType`](/api/isOfType.md)
