diff --git a/src/Psl/Internal/Loader.php b/src/Psl/Internal/Loader.php index 31f9871..1849964 100644 --- a/src/Psl/Internal/Loader.php +++ b/src/Psl/Internal/Loader.php @@ -215,6 +215,7 @@ final class Loader 'Psl\Str\Byte\search', 'Psl\Str\Byte\search_ci', 'Psl\Str\Byte\search_last', + 'Psl\Str\Byte\search_last_ci', 'Psl\Str\Byte\shuffle', 'Psl\Str\Byte\slice', 'Psl\Str\Byte\splice', @@ -229,6 +230,14 @@ final class Loader 'Psl\Str\Byte\uppercase', 'Psl\Str\Byte\words', 'Psl\Str\Byte\wrap', + 'Psl\Str\Byte\after', + 'Psl\Str\Byte\after_ci', + 'Psl\Str\Byte\after_last', + 'Psl\Str\Byte\after_last_ci', + 'Psl\Str\Byte\before', + 'Psl\Str\Byte\before_ci', + 'Psl\Str\Byte\before_last', + 'Psl\Str\Byte\before_last_ci', 'Psl\Str\capitalize', 'Psl\Str\capitalize_words', 'Psl\Str\chr', @@ -278,6 +287,14 @@ final class Loader 'Psl\Str\uppercase', 'Psl\Str\width', 'Psl\Str\wrap', + 'Psl\Str\after', + 'Psl\Str\after_ci', + 'Psl\Str\after_last', + 'Psl\Str\after_last_ci', + 'Psl\Str\before', + 'Psl\Str\before_ci', + 'Psl\Str\before_last', + 'Psl\Str\before_last_ci', 'Psl\invariant', 'Psl\invariant_violation', 'Psl\sequence', @@ -353,6 +370,14 @@ final class Loader 'Psl\Str\Grapheme\starts_with_ci', 'Psl\Str\Grapheme\strip_prefix', 'Psl\Str\Grapheme\strip_suffix', + 'Psl\Str\Grapheme\after', + 'Psl\Str\Grapheme\after_ci', + 'Psl\Str\Grapheme\after_last', + 'Psl\Str\Grapheme\after_last_ci', + 'Psl\Str\Grapheme\before', + 'Psl\Str\Grapheme\before_ci', + 'Psl\Str\Grapheme\before_last', + 'Psl\Str\Grapheme\before_last_ci', ]; public const INTERFACES = [ diff --git a/src/Psl/Str/Byte/after.php b/src/Psl/Str/Byte/after.php new file mode 100644 index 0000000..7132bf9 --- /dev/null +++ b/src/Psl/Str/Byte/after.php @@ -0,0 +1,24 @@ += -$haystack_length && $offset <= $haystack_length, 'Offset is out-of-bounds.'); + + return false === ($pos = strripos($haystack, $needle, $offset)) ? null : $pos; +} diff --git a/src/Psl/Str/Grapheme/after.php b/src/Psl/Str/Grapheme/after.php new file mode 100644 index 0000000..dc43fd4 --- /dev/null +++ b/src/Psl/Str/Grapheme/after.php @@ -0,0 +1,24 @@ +