Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions src/Utils/Strings.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,9 @@ public static function indent(string $s, int $level = 1, string $chars = "\t"):

/**
* Converts all characters of UTF-8 string to lower case.
* @template T of string
* @param T $s
* @return T
*/
public static function lower(string $s): string
{
Expand All @@ -282,6 +285,9 @@ public static function lower(string $s): string

/**
* Converts the first character of a UTF-8 string to lower case and leaves the other characters unchanged.
* @template T of string
* @param T $s
* @return T
*/
public static function firstLower(string $s): string
{
Expand All @@ -291,6 +297,9 @@ public static function firstLower(string $s): string

/**
* Converts all characters of a UTF-8 string to upper case.
* @template T of string
* @param T $s
* @return T
*/
public static function upper(string $s): string
{
Expand All @@ -300,6 +309,9 @@ public static function upper(string $s): string

/**
* Converts the first character of a UTF-8 string to upper case and leaves the other characters unchanged.
* @template T of string
* @param T $s
* @return T
*/
public static function firstUpper(string $s): string
{
Expand All @@ -309,6 +321,9 @@ public static function firstUpper(string $s): string

/**
* Converts the first character of every word of a UTF-8 string to upper case and the others to lower case.
* @template T of string
* @param T $s
* @return T
*/
public static function capitalize(string $s): string
{
Expand Down Expand Up @@ -425,7 +440,7 @@ public static function reverse(string $s): string


/**
* Returns part of $haystack before $nth occurence of $needle or returns null if the needle was not found.
* Returns part of $haystack before $nth occurrence of $needle or returns null if the needle was not found.
* Negative value means searching from the end.
*/
public static function before(string $haystack, string $needle, int $nth = 1): ?string
Expand All @@ -438,7 +453,7 @@ public static function before(string $haystack, string $needle, int $nth = 1): ?


/**
* Returns part of $haystack after $nth occurence of $needle or returns null if the needle was not found.
* Returns part of $haystack after $nth occurrence of $needle or returns null if the needle was not found.
* Negative value means searching from the end.
*/
public static function after(string $haystack, string $needle, int $nth = 1): ?string
Expand All @@ -451,7 +466,7 @@ public static function after(string $haystack, string $needle, int $nth = 1): ?s


/**
* Returns position in characters of $nth occurence of $needle in $haystack or null if the $needle was not found.
* Returns position in characters of $nth occurrence of $needle in $haystack or null if the $needle was not found.
* Negative value of `$nth` means searching from the end.
*/
public static function indexOf(string $haystack, string $needle, int $nth = 1): ?int
Expand All @@ -464,7 +479,7 @@ public static function indexOf(string $haystack, string $needle, int $nth = 1):


/**
* Returns position in characters of $nth occurence of $needle in $haystack or null if the needle was not found.
* Returns position in characters of $nth occurrence of $needle in $haystack or null if the needle was not found.
*/
private static function pos(string $haystack, string $needle, int $nth = 1): ?int
{
Expand Down
Loading