You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `Str::makeWords()` method replaces a delimiter with a space, `' '`, in given string with the option to title case the result.
472
+
473
+
```php
474
+
use \TypeRocket\Utility\Str;
475
+
476
+
Str::makeWords('foo_bar', false);
477
+
// foo bar
478
+
479
+
Str::makeWords('foo_bar', true);
480
+
// Foo Bar
481
+
482
+
Str::makeWords('foo-bar', true, '-');
483
+
// Foo Bar
484
+
```
485
+
469
486
### Str::notBlank
470
487
471
-
Use the method `Str::notBlank()`to check if a value is `null` or an empty string.
488
+
The `Str::notBlank()`method checks if a value is `null` or an empty string.
472
489
473
490
```php
474
491
use \TypeRocket\Utility\Str;
@@ -486,6 +503,28 @@ Str::notBlank(' ');
486
503
// true
487
504
```
488
505
506
+
### Str::pregMatchFindFirst
507
+
508
+
The `Str::pregMatchFindFirst()` method returns the first regex pattern to match a given string. However, the regex applies `#` vs `/` as the delimiters:
509
+
510
+
```php
511
+
use \TypeRocket\Utility\Str;
512
+
513
+
// Do not use delimiters at the
514
+
// start and end of patterns.
515
+
$patters = [
516
+
'[a-z]+',
517
+
'brother',
518
+
'dad',
519
+
'mom'
520
+
];
521
+
522
+
$subject = 'dad';
523
+
524
+
Str::pregMatchFindFirst($patters, $subject);
525
+
// '[a-z]+'
526
+
```
527
+
489
528
### Str::replaceFirst
490
529
491
530
The `Str::replaceFirst()` method replaces the first occurrence of a given value in the string:
0 commit comments