@@ 530-543 (lines=14) @@ | ||
527 | * |
|
528 | * @return bool <p>Whether or not $str starts with $substring.</p> |
|
529 | */ |
|
530 | public function startsWithAny(array $substrings, $caseSensitive = true) |
|
531 | { |
|
532 | if (empty($substrings)) { |
|
533 | return false; |
|
534 | } |
|
535 | ||
536 | foreach ($substrings as $substring) { |
|
537 | if ($this->startsWith($substring, $caseSensitive)) { |
|
538 | return true; |
|
539 | } |
|
540 | } |
|
541 | ||
542 | return false; |
|
543 | } |
|
544 | ||
545 | /** |
|
546 | * Ensures that the string ends with $substring. If it doesn't, it's appended. |
|
@@ 603-616 (lines=14) @@ | ||
600 | * |
|
601 | * @return bool <p>Whether or not $str ends with $substring.</p> |
|
602 | */ |
|
603 | public function endsWithAny($substrings, $caseSensitive = true) |
|
604 | { |
|
605 | if (empty($substrings)) { |
|
606 | return false; |
|
607 | } |
|
608 | ||
609 | foreach ($substrings as $substring) { |
|
610 | if ($this->endsWith($substring, $caseSensitive)) { |
|
611 | return true; |
|
612 | } |
|
613 | } |
|
614 | ||
615 | return false; |
|
616 | } |
|
617 | ||
618 | /** |
|
619 | * Returns the first $n characters of the string. |