mirror of
https://github.com/Respect/Validation.git
synced 2024-06-08 00:32:16 +02:00
10df3211f5
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
46 lines
807 B
Markdown
46 lines
807 B
Markdown
# StartsWith
|
|
|
|
- `StartsWith(mixed $value)`
|
|
- `StartsWith(mixed $value, bool $identical)`
|
|
|
|
Validates whether the input starts with a given value.
|
|
|
|
This validator is similar to [Contains](Contains.md), but validates only
|
|
if the value is at the beginning of the input.
|
|
|
|
For strings:
|
|
|
|
```php
|
|
v::startsWith('lorem')->validate('lorem ipsum'); // true
|
|
```
|
|
|
|
For arrays:
|
|
|
|
```php
|
|
v::startsWith('lorem')->validate(['lorem', 'ipsum']); // true
|
|
```
|
|
|
|
`true` may be passed as a parameter to indicate identical comparison
|
|
instead of equal.
|
|
|
|
Message template for this validator includes `{{startValue}}`.
|
|
|
|
## Categorization
|
|
|
|
- Arrays
|
|
- Strings
|
|
|
|
## Changelog
|
|
|
|
Version | Description
|
|
--------|-------------
|
|
0.3.9 | Created
|
|
|
|
***
|
|
See also:
|
|
|
|
- [Contains](Contains.md)
|
|
- [EndsWith](EndsWith.md)
|
|
- [In](In.md)
|
|
- [Regex](Regex.md)
|