|
1 | | -# Type Functions |
| 1 | +# String Functions |
2 | 2 |
|
3 | | -[](https://travis-ci.org/typedphp/type-functions) |
4 | | -[](https://scrutinizer-ci.com/g/typedphp/type-functions) |
5 | | -[](http://typedphp.github.io/type-functions/master) |
6 | | -[](https://packagist.org/packages/typedphp/type-functions) |
7 | | -[](licence.md) |
| 3 | +[](https://travis-ci.org/typedphp/string-functions) |
| 4 | +[](https://scrutinizer-ci.com/g/typedphp/string-functions) |
| 5 | +[](http://typedphp.github.io/string-functions/master) |
| 6 | +[](https://packagist.org/packages/typedphp/string-functions) |
| 7 | +[](licence.md) |
8 | 8 |
|
9 | 9 | ## Example |
10 | 10 |
|
11 | 11 | ```php |
12 | | -use TypedPHP\Functions\TypeFunctions; |
| 12 | +use TypedPHP\Functions\StringFunctions; |
13 | 13 |
|
14 | | -TypeFunctions\getType(1.5); // number |
15 | | - |
16 | | -TypeFunctions\isBoolean(false); // true |
17 | | -TypeFunctions\isBoolean("false"); // false |
| 14 | +StringFunctions\endsWith("a long string", "string"); // true |
| 15 | +StringFunctions\replace("a long string", "long", "enormous"); // "a enormous string" |
18 | 16 | ``` |
19 | 17 |
|
20 | 18 | Functions: |
21 | 19 |
|
22 | | -- `isNumber` |
23 | | -- `isBoolean` |
24 | | -- `isNull` |
25 | | -- `isObject` |
26 | | -- `isFunction` |
27 | | -- `isExpression` |
28 | | -- `isString` |
29 | | -- `isResource` |
30 | | -- `getType` |
31 | | - |
32 | | -Caveats: |
33 | | - |
34 | | -- `isExpression` will return false if `isString` returns true. |
35 | | -- `isFunction` will return false if `isObject` returns true. |
36 | | -- `getType` will return unknown if the argument is not matched by any of the `is*` functions. |
| 20 | +- `startsWith` |
| 21 | +- `endsWith` |
| 22 | +- `indexOf` |
| 23 | +- `length` |
| 24 | +- `matches` |
| 25 | +- `replace` |
| 26 | +- `slice` |
| 27 | +- `split` |
37 | 28 |
|
38 | 29 | ## Installation |
39 | 30 |
|
40 | 31 | ```sh |
41 | | -❯ composer require "typedphp/type-functions:*" |
| 32 | +❯ composer require "typedphp/string-functions:*" |
42 | 33 | ``` |
43 | 34 |
|
44 | 35 | ## Testing |
45 | 36 |
|
46 | 37 | ```sh |
47 | | -❯ composer create-project "typedphp/type-functions:*" . |
| 38 | +❯ composer create-project "typedphp/string-functions:*" . |
48 | 39 | ❯ vendor/bin/phpunit |
49 | 40 | ``` |
0 commit comments