2015-01-30 09:40:06 +01:00
|
|
|
# StartsWith
|
|
|
|
|
2017-03-27 14:47:07 +02:00
|
|
|
- `StartsWith(mixed $value)`
|
|
|
|
- `StartsWith(mixed $value, bool $identical)`
|
2015-01-30 09:40:06 +01:00
|
|
|
|
2019-03-03 22:27:45 +01:00
|
|
|
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.
|
2015-01-30 09:40:06 +01:00
|
|
|
|
|
|
|
For strings:
|
|
|
|
|
|
|
|
```php
|
2015-10-20 02:53:25 +02:00
|
|
|
v::startsWith('lorem')->validate('lorem ipsum'); // true
|
2015-01-30 09:40:06 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
For arrays:
|
|
|
|
|
|
|
|
```php
|
2015-10-20 02:53:25 +02:00
|
|
|
v::startsWith('lorem')->validate(['lorem', 'ipsum']); // true
|
2015-01-30 09:40:06 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
`true` may be passed as a parameter to indicate identical comparison
|
|
|
|
instead of equal.
|
|
|
|
|
|
|
|
Message template for this validator includes `{{startValue}}`.
|
|
|
|
|
2019-05-11 18:32:13 +02:00
|
|
|
## Categorization
|
|
|
|
|
|
|
|
- Arrays
|
|
|
|
- Strings
|
|
|
|
|
2017-03-27 22:04:13 +02:00
|
|
|
## Changelog
|
|
|
|
|
|
|
|
Version | Description
|
|
|
|
--------|-------------
|
|
|
|
0.3.9 | Created
|
|
|
|
|
2015-08-20 06:38:41 +02:00
|
|
|
***
|
2015-01-30 09:40:06 +01:00
|
|
|
See also:
|
|
|
|
|
2017-03-28 11:53:14 +02:00
|
|
|
- [Contains](Contains.md)
|
2018-12-11 13:31:50 +01:00
|
|
|
- [EndsWith](EndsWith.md)
|
2017-03-28 11:53:14 +02:00
|
|
|
- [In](In.md)
|
2018-12-11 13:31:50 +01:00
|
|
|
- [Regex](Regex.md)
|