@@ -20,9 +20,9 @@ You can install the package via composer:
20
20
composer require dvlpr1996/php-string-helpers
21
21
```
22
22
23
- ## StrUtility usage
23
+ ## StrUtility usage as static methods
24
24
25
- String helper methods are static so usage like the following:
25
+ you can use String helper methods as static so usage like the following:
26
26
First Using The StrUtility Class:
27
27
28
28
``` php
@@ -349,13 +349,47 @@ StrUtility::rmFirstWord(string $string): string
349
349
``` php
350
350
StrUtility::is_slug(string $slug): bool
351
351
```
352
- ## PhpStringHelpers usage
352
+
353
+ - find whether the type of a given ip is valid ipv4
354
+
355
+ ``` php
356
+ StrUtility::is_ipv4(string $ip): bool
357
+ ```
358
+
359
+ - find whether the type of a given ip is valid ipv6
360
+
361
+ ``` php
362
+ StrUtility::is_ipv6(string $ip): bool
363
+ ```
364
+
365
+ - Deletes the words before the given $search word
366
+
367
+ ``` php
368
+ StrUtility::after(string $string, string $search): string
369
+ ```
370
+
371
+ - Deletes the words after the given $search word
372
+
373
+ ``` php
374
+ StrUtility::before(string $string, string $search): string
375
+ ```
376
+
377
+ ## StrUtility usage as helper functions
353
378
354
379
String helper functions are global so usage like the following:
355
380
356
381
``` php
357
382
decrementBy(string $string, ?string $separator = null): string
358
383
```
384
+ ## StrUtility usage as object
385
+
386
+ ``` php
387
+ use PhpStringHelpers\utility\StrUtility;
388
+
389
+ $string = new StrUtility;
390
+
391
+ $string->toConstant('foo bar baz');
392
+ ```
359
393
360
394
## Changelog
361
395
0 commit comments