1 | <?php namespace BuildR\Utils; |
||
15 | class StringUtils { |
||
16 | |||
17 | /** |
||
18 | * Determines that the given string starts with the |
||
19 | * given substring |
||
20 | * |
||
21 | * @param string $input |
||
22 | * @param string $match |
||
23 | * |
||
24 | * @return bool |
||
25 | */ |
||
26 | 5 | public static function startsWith($input, $match) { |
|
27 | 5 | return ($match !== '' && mb_strpos($input, $match) === 0); |
|
28 | } |
||
29 | |||
30 | /** |
||
31 | * Determines that the given string ends with the |
||
32 | * given substring |
||
33 | * |
||
34 | * @param string $input |
||
35 | * @param string $match |
||
36 | * |
||
37 | * @return bool |
||
38 | */ |
||
39 | 5 | public static function endsWith($input, $match) { |
|
40 | 5 | return ((string) $match === mb_substr($input, (mb_strlen($match) * -1))); |
|
41 | } |
||
42 | |||
43 | /** |
||
44 | * Determines that the input string contains the |
||
45 | * given substring. |
||
46 | * |
||
47 | * @param string $input |
||
48 | * @param string $match |
||
49 | * |
||
50 | * @return bool |
||
51 | */ |
||
52 | 7 | public static function contains($input, $match) { |
|
55 | |||
56 | } |
||
57 |