Skip to content

Commit 84bd53a

Browse files
Document version-specific UUID string validation (#10686)
1 parent bab1b28 commit 84bd53a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

strings.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2666,6 +2666,20 @@ $result = Str::of('Taylor')->isUuid();
26662666
// false
26672667
```
26682668

2669+
You may also validate that the given UUID matches a UUID specification by version (1, 3, 4, 5, 6, 7, or 8):
2670+
2671+
```php
2672+
use Illuminate\Support\Str;
2673+
2674+
$isUuid = Str::of('a0a2a2d2-0b87-4a18-83f2-2529882be2de')->isUuid(version: 4);
2675+
2676+
// true
2677+
2678+
$isUuid = Str::of('a0a2a2d2-0b87-4a18-83f2-2529882be2de')->isUuid(version: 1);
2679+
2680+
// false
2681+
```
2682+
26692683
<a name="method-fluent-str-kebab"></a>
26702684
#### `kebab` {.collection-method}
26712685

0 commit comments

Comments
 (0)