File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed
Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -492,6 +492,39 @@ public function equal($str): bool
492492 return ($ this ->value === $ str );
493493 }
494494
495+ /**
496+ * Checks if a string contains a given substring
497+ *
498+ * @param string $needle
499+ * @return bool
500+ */
501+ public function contains (string $ needle ): bool
502+ {
503+ return str_contains ($ this ->value , $ needle );
504+ }
505+
506+ /**
507+ * Checks if a string starts with a given substring
508+ *
509+ * @param string $needle
510+ * @return bool
511+ */
512+ public function startsWith (string $ needle ): bool
513+ {
514+ return str_starts_with ($ this ->value , $ needle );
515+ }
516+
517+ /**
518+ * Checks if a string ends with a given substring
519+ *
520+ * @param string $needle
521+ * @return bool
522+ */
523+ public function endsWith (string $ needle ): bool
524+ {
525+ return str_ends_with ($ this ->value , $ needle );
526+ }
527+
495528 /**
496529 * IF value equals to param
497530 * @param $str
Original file line number Diff line number Diff line change @@ -57,6 +57,18 @@ Inp::value("Lorem ipsum dolor")->equal("Lorem ipsum dolor");
5757``` php
5858Inp::value("Lorem ipsum dolor")->notEqual("Lorem ipsum");
5959```
60+ - ** Contains** :
61+ ``` php
62+ Inp::value("Lorem ipsum dolor")->contains("ipsum");
63+ ```
64+ - ** Starts with** :
65+ ``` php
66+ Inp::value("Lorem ipsum dolor")->startsWith("Lorem");
67+ ```
68+ - ** Ends with** :
69+ ``` php
70+ Inp::value("Lorem ipsum dolor")->endsWith("dolor");
71+ ```
6072
6173### Validate if it's a valid email
6274``` php
You can’t perform that action at this time.
0 commit comments