{"id":36976899,"url":"https://github.com/flextype-components/strings","last_synced_at":"2026-01-13T22:45:37.315Z","repository":{"id":62505541,"uuid":"291232558","full_name":"flextype-components/strings","owner":"flextype-components","description":"Strings Component is a set of methods to help with the manipulation of strings.","archived":false,"fork":false,"pushed_at":"2020-09-12T08:20:02.000Z","size":112,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-13T09:46:44.802Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flextype-components.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-29T08:31:02.000Z","updated_at":"2020-09-09T11:33:25.000Z","dependencies_parsed_at":"2022-11-02T12:30:41.502Z","dependency_job_id":null,"html_url":"https://github.com/flextype-components/strings","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/flextype-components/strings","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flextype-components%2Fstrings","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flextype-components%2Fstrings/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flextype-components%2Fstrings/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flextype-components%2Fstrings/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flextype-components","download_url":"https://codeload.github.com/flextype-components/strings/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flextype-components%2Fstrings/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28402219,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-13T22:45:36.624Z","updated_at":"2026-01-13T22:45:37.299Z","avatar_url":"https://github.com/flextype-components.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eStrings Component\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/flextype-components/strings/releases\"\u003e\u003cimg alt=\"Version\" src=\"https://img.shields.io/github/release/flextype-components/strings.svg?label=version\u0026color=green\"\u003e\u003c/a\u003e \u003ca href=\"https://github.com/flextype-components/strings\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-MIT-blue.svg?color=green\" alt=\"License\"\u003e\u003c/a\u003e \u003ca href=\"https://github.com/flextype-components/strings\"\u003e\u003cimg src=\"https://img.shields.io/github/downloads/flextype-components/strings/total.svg?color=green\" alt=\"Total downloads\"\u003e\u003c/a\u003e \u003ca href=\"https://scrutinizer-ci.com/g/flextype-components/strings?branch=master\"\u003e\u003cimg src=\"https://img.shields.io/scrutinizer/g/flextype-components/strings.svg?branch=master\u0026color=green\" alt=\"Quality Score\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cbr\u003e\n\n### Installation\n\nWith [Composer](https://getcomposer.org):\n\n```\ncomposer require flextype-components/strings\n```\n\n### Usage\n\n```php\nuse Flextype\\Component\\Strings;\n```\n\n### Methods\n\n| Method | Description |\n|---|---|\n| \u003ca href=\"#strings_stripSpaces\"\u003e`Strings::stripSpaces()`\u003c/a\u003e | Strip all whitespaces from the given string. |\n| \u003ca href=\"#strings_trimSlashes\"\u003e`Strings::trimSlashes()`\u003c/a\u003e | Removes any leading and trailing slashes from a string. |\n| \u003ca href=\"#strings_reduceSlashes\"\u003e`Strings::reduceSlashes()`\u003c/a\u003e | Reduces multiple slashes in a string to single slashes. |\n| \u003ca href=\"#strings_stripQuotes\"\u003e`Strings::stripQuotes()`\u003c/a\u003e | Removes single and double quotes from a string. |\n| \u003ca href=\"#strings_quotesToEntities\"\u003e`Strings::quotesToEntities()`\u003c/a\u003e | Convert single and double quotes to entities. |\n| \u003ca href=\"#strings_validEncoding\"\u003e`Strings::validEncoding()`\u003c/a\u003e | Checks if the string is valid in UTF-8 encoding. |\n| \u003ca href=\"#strings_fixEncoding\"\u003e`Strings::fixEncoding()`\u003c/a\u003e | Removes all invalid UTF-8 characters from a string. |\n| \u003ca href=\"#strings_normalizeNewLines\"\u003e`Strings::normalizeNewLines()`\u003c/a\u003e | Standardize line endings to unix-like. |\n| \u003ca href=\"#strings_normalizeSpaces\"\u003e`Strings::normalizeSpaces()`\u003c/a\u003e | Normalize white-spaces to a single space. |\n| \u003ca href=\"#strings_random\"\u003e`Strings::random()`\u003c/a\u003e | Creates a random string of characters. |\n| \u003ca href=\"#strings_increment\"\u003e`Strings::increment()`\u003c/a\u003e | Add's `_1` to a string or increment the ending number to allow `_2`, `_3`, etc. |\n| \u003ca href=\"#strings_wordsCount\"\u003e`Strings::wordsCount()`\u003c/a\u003e | Return information about words used in a string. |\n| \u003ca href=\"#strings_length\"\u003e`Strings::length()`\u003c/a\u003e | Return the length of the given string. |\n| \u003ca href=\"#strings_lower\"\u003e`Strings::lower()`\u003c/a\u003e | Convert the given string to lower-case. |\n| \u003ca href=\"#strings_upper\"\u003e`Strings::upper()`\u003c/a\u003e | Convert the given string to upper-case. |\n| \u003ca href=\"#strings_limit\"\u003e`Strings::limit()`\u003c/a\u003e | Limit the number of characters in a string. |\n| \u003ca href=\"#strings_studly\"\u003e`Strings::studly()`\u003c/a\u003e | Convert a value to studly caps case. |\n| \u003ca href=\"#strings_snake\"\u003e`Strings::snake()`\u003c/a\u003e | Convert a string to snake case. |\n| \u003ca href=\"#strings_camel\"\u003e`Strings::camel()`\u003c/a\u003e | Convert a string to camel case. |\n| \u003ca href=\"#strings_kebab\"\u003e`Strings::kebab()`\u003c/a\u003e | Convert a string to kebab case. |\n| \u003ca href=\"#strings_words\"\u003e`Strings::words()`\u003c/a\u003e | Limit the number of words in a string. |\n| \u003ca href=\"#strings_contains\"\u003e`Strings::contains()`\u003c/a\u003e | Determine if a given string contains a given substring. |\n| \u003ca href=\"#strings_containsAll\"\u003e`Strings::containsAll()`\u003c/a\u003e | Determine if a given string contains all array values. |\n| \u003ca href=\"#strings_containsAny\"\u003e`Strings::containsAny()`\u003c/a\u003e | Determine if a given string contains any of array values. |\n| \u003ca href=\"#strings_substr\"\u003e`Strings::substr()`\u003c/a\u003e | Returns the portion of string specified by the start and length parameters. |\n| \u003ca href=\"#strings_ucfirst\"\u003e`Strings::ucfirst()`\u003c/a\u003e | Converts the first character of a UTF-8 string to upper case and leaves the other characters unchanged. |\n| \u003ca href=\"#strings_trim\"\u003e`Strings::trim()`\u003c/a\u003e | Strip whitespace (or other characters) from the beginning and end of a string. |\n| \u003ca href=\"#strings_trimRight\"\u003e`Strings::trimRight()`\u003c/a\u003e | Strip whitespace (or other characters) from the end of a string. |\n| \u003ca href=\"#strings_trimLeft\"\u003e`Strings::trimLeft()`\u003c/a\u003e | Strip whitespace (or other characters) from the beginning of a string. |\n| \u003ca href=\"#strings_capitalize\"\u003e`Strings::capitalize()`\u003c/a\u003e | Converts the first character of every word of string to upper case and the others to lower case. |\n| \u003ca href=\"#strings_reverse\"\u003e`Strings::reverse()`\u003c/a\u003e | Reverses string. |\n| \u003ca href=\"#strings_segments\"\u003e`Strings::segments()`\u003c/a\u003e | Get array of segments from a string based on a delimiter. |\n| \u003ca href=\"#strings_segment\"\u003e`Strings::segment()`\u003c/a\u003e | Get a segment from a string based on a delimiter. Returns an empty string when the offset doesn't exist. Use a negative index to start counting from the last element. |\n| \u003ca href=\"#strings_firstSegment\"\u003e`Strings::firstSegment()`\u003c/a\u003e | Get the first segment from a string based on a delimiter. |\n| \u003ca href=\"#strings_lastSegment\"\u003e`Strings::lastSegment()`\u003c/a\u003e | Get the last segment from a string based on a delimiter. |\n| \u003ca href=\"#strings_between\"\u003e`Strings::between()`\u003c/a\u003e | Get the portion of a string between two given values. |\n| \u003ca href=\"#strings_before\"\u003e`Strings::before()`\u003c/a\u003e | Get the portion of a string before the first occurrence of a given value. |\n| \u003ca href=\"#strings_beforeLast\"\u003e`Strings::beforeLast()`\u003c/a\u003e | Get the portion of a string before the last occurrence of a given value. |\n| \u003ca href=\"#strings_after\"\u003e`Strings::after()`\u003c/a\u003e | Return the remainder of a string after the first occurrence of a given value. |\n| \u003ca href=\"#strings_afterLast\"\u003e`Strings::afterLast()`\u003c/a\u003e | Return the remainder of a string after the last occurrence of a given value. |\n| \u003ca href=\"#strings_padBoth\"\u003e`Strings::padBoth()`\u003c/a\u003e | Pad both sides of a string with another. |\n| \u003ca href=\"#strings_padLeft\"\u003e`Strings::padLeft()`\u003c/a\u003e | Pad the left side of a string with another. |\n| \u003ca href=\"#strings_padRight\"\u003e`Strings::padRight()`\u003c/a\u003e | Pad the right side of a string with another. |\n| \u003ca href=\"#strings_replaceArray\"\u003e`Strings::replaceArray()`\u003c/a\u003e | Replace a given value in the string sequentially with an array. |\n| \u003ca href=\"#strings_replaceFirst\"\u003e`Strings::replaceFirst()`\u003c/a\u003e | Replace the first occurrence of a given value in the string. |\n| \u003ca href=\"#strings_replaceLast\"\u003e`Strings::replaceLast()`\u003c/a\u003e | Replace the last occurrence of a given value in the string. |\n| \u003ca href=\"#strings_start\"\u003e`Strings::start()`\u003c/a\u003e | Begin a string with a single instance of a given value. |\n| \u003ca href=\"#strings_startsWith\"\u003e`Strings::startsWith()`\u003c/a\u003e | Determine if a given string starts with a given substring. |\n| \u003ca href=\"#strings_endsWith\"\u003e`Strings::endsWith()`\u003c/a\u003e | Determine if a given string ends with a given substring. |\n| \u003ca href=\"#strings_finish\"\u003e`Strings::finish()`\u003c/a\u003e | Cap a string with a single instance of a given value. |\n| \u003ca href=\"#strings_hash\"\u003e`Strings::hash()`\u003c/a\u003e | Generate a hash string from the input string. |\n\n\u003chr\u003e\n\n#### \u003ca name=\"strings_stripSpaces\"\u003e\u003c/a\u003e Method: `Strings::stripSpaces()`\n\nStrip all whitespaces from the given string.\n\n```php\n$string = Strings::stripSpaces('SG-1 returns from an off-world mission');\n```\n\n#### \u003ca name=\"strings_trimSlashes\"\u003e\u003c/a\u003e Method: `Strings::trimSlashes()`\n\nRemoves any leading and trailing slashes from a string.\n\n```php\n$string = Strings::trimSlashes('some string here/');\n```\n\n#### \u003ca name=\"strings_reduceSlashes\"\u003e\u003c/a\u003e Method: `Strings::reduceSlashes()`\n\nReduces multiple slashes in a string to single slashes.\n\n```php\n$string = Strings::reduceSlashes('some//text//here');\n```\n\n#### \u003ca name=\"strings_stripQuotes\"\u003e\u003c/a\u003e Method: `Strings::stripQuotes()`\n\nRemoves single and double quotes from a string.\n\n```php\n$string = Strings::stripQuotes('some \"text\" here');\n```\n\n#### \u003ca name=\"strings_quotesToEntities\"\u003e\u003c/a\u003e Method: `Strings::quotesToEntities()`\n\nConvert single and double quotes to entities.\n\n```php\n$string = Strings::quotesToEntities('some \"text\" here');\n```\n\n#### \u003ca name=\"strings_validEncoding\"\u003e\u003c/a\u003e Method: `Strings::validEncoding()`\n\nChecks if the string is valid in UTF-8 encoding.\n\n```php\n$result = Strings::validEncoding('An UTF-8 string here');\n```\n\n#### \u003ca name=\"strings_fixEncoding\"\u003e\u003c/a\u003e Method: `Strings::fixEncoding()`\n\nRemoves all invalid UTF-8 characters from a string.\n\n```php\n$string = Strings::fixEncoding('An invalid UTF-8 string here');\n```\n\n#### \u003ca name=\"strings_normalizeNewLines\"\u003e\u003c/a\u003e Method: `Strings::normalizeNewLines()`\n\nStandardize line endings to unix-like.\n\n```php\n$string = Strings::normalizeNewLines('SG-1 returns from an off-world mission');\n```\n\n#### \u003ca name=\"strings_normalizeSpaces\"\u003e\u003c/a\u003e Method: `Strings::normalizeSpaces()`\n\nNormalize white-spaces to a single space.\n\n```php\n$string = Strings::normalizeSpaces('SG-1  returns  from  an  off-world  mission');\n```\n\n#### \u003ca name=\"strings_random\"\u003e\u003c/a\u003e Method: `Strings::random()`\n\n```php\n// Get random string with predefined settings\n$string = Strings::random();\n\n// Get random string with custom length\n$string = Strings::random(10);\n\n// Get random string with custom length and custom keyspace\n$string = Strings::random(4, '0123456789');\n```\n\n#### \u003ca name=\"strings_increment\"\u003e\u003c/a\u003e Method: `Strings::increment()`\n\nAdd's `_1` to a string or increment the ending number to allow `_2`, `_3`, etc.\n\n```php\n// Increment string with predefined settings\n$string = Strings::increment('page_1');\n\n// Increment string with custom settings\n$string = Strings::increment('page-1', 1, '-');\n```\n\n#### \u003ca name=\"strings_wordsCount\"\u003e\u003c/a\u003e Method: `Strings::wordsCount()`\n\nReturn information about words used in a string\n\n```php\n// Returns the number of words found\n$result = Strings::wordsCount('SG-1 returns from an off-world mission to P9Y-3C3 with Daniel Jackson');\n\n// Returns an array containing all the words found inside the string\n$result = Strings::wordsCount('SG-1 returns from an off-world mission to P9Y-3C3 with Daniel Jackson', 1)\n\n// Returns an associative array, where the key is the numeric position of the word inside the string and the value is the actual word itself\n$result = Strings::wordsCount('SG-1 returns from an off-world mission to P9Y-3C3 with Daniel Jackson', 2)\n```\n\n#### \u003ca name=\"strings_length\"\u003e\u003c/a\u003e Method: `Strings::length()`\n\nReturn the length of the given string.\n\n```php\n$length = Strings::length('SG-1 returns from an off-world mission to P9Y-3C3');\n```\n\n#### \u003ca name=\"strings_lower\"\u003e\u003c/a\u003e Method: `Strings::lower()`\n\nConvert the given string to lower-case.\n\n```php\n$string = Strings::lower('SG-1 returns from an off-world mission to P9Y-3C3');\n```\n\n#### \u003ca name=\"strings_upper\"\u003e\u003c/a\u003e Method: `Strings::upper()`\n\nConvert the given string to upper-case.\n\n```php\n$string = Strings::upper('SG-1 returns from an off-world mission to P9Y-3C3');\n```\n\n#### \u003ca name=\"strings_limit\"\u003e\u003c/a\u003e Method: `Strings::limit()`\n\nLimit the number of characters in a string.\n\n```php\n// Get string with predefined limit settings\n$string = Strings::limit('SG-1 returns from an off-world mission to P9Y-3C3');\n\n// Get string with limit 10\n$string = Strings::limit('SG-1 returns from an off-world mission to P9Y-3C3', 10);\n\n// Get string with limit 10 and append 'read more...'\n$string = Strings::limit('SG-1 returns from an off-world mission to P9Y-3C3', 10, 'read more...');\n```\n\n#### \u003ca name=\"strings_studly\"\u003e\u003c/a\u003e Method: `Strings::studly()`\n\nConvert a value to studly caps case.\n\n```php\n$string = Strings::studly('foo_bar');\n```\n\n#### \u003ca name=\"strings_snake\"\u003e\u003c/a\u003e Method: `Strings::snake()`\n\nConvert a string to snake case.\n\n```php\n$string = Strings::snake('fooBar');\n```\n\n#### \u003ca name=\"strings_camel\"\u003e\u003c/a\u003e Method: `Strings::camel()`\n\nConvert a string to camel case.\n\n```php\n$string = Strings::camel('foo_bar');\n```\n\n#### \u003ca name=\"strings_kebab\"\u003e\u003c/a\u003e Method: `Strings::kebab()`\n\nConvert a string to kebab case.\n\n```php\n$string = Strings::kebab('fooBar');\n```\n\n#### \u003ca name=\"strings_words\"\u003e\u003c/a\u003e Method: `Strings::words()`\n\nLimit the number of words in a string.\n\n```php\n// Get the number of words in a string with predefined limit settings\n$string = Strings::words('SG-1 returns from an off-world mission to P9Y-3C3');\n\n// Get the number of words in a string with limit 3\n$string = Strings::words('SG-1 returns from an off-world mission to P9Y-3C3', 3);\n\n// Get the number of words in a string with limit 3 and append 'read more...'\n$string = Strings::words('SG-1 returns from an off-world mission to P9Y-3C3', 3, 'read more...');\n```\n\n#### \u003ca name=\"strings_contains\"\u003e\u003c/a\u003e Method: `Strings::contains()`\n\nDetermine if a given string contains a given substring.\n\n```php\n// Determine if a given string contains a given substring.\n$result = Strings::contains('SG-1 returns from an off-world mission to P9Y-3C3', 'SG-1');\n\n// Determine if a given string contains a given array of substrings.\n$result = Strings::contains('SG-1 returns from an off-world mission to P9Y-3C3', ['SG-1', 'P9Y-3C3']);\n```\n\n#### \u003ca name=\"strings_containsAll\"\u003e\u003c/a\u003e Method: `Strings::containsAll()`\n\nDetermine if a given string contains a given array of substrings.\n\n```php\n$result = Strings::containsAll('SG-1 returns from an off-world mission to P9Y-3C3', ['SG-1', 'P9Y-3C3']);\n```\n\n#### \u003ca name=\"strings_containsAny\"\u003e\u003c/a\u003e Method: `Strings::containsAny()`\n\nDetermine if a given string contains any of array values.\n\n```php\n$result = Strings::containsAny('SG-1 returns from an off-world mission to P9Y-3C3', ['SG-1', 'P9Y-3C3']);\n```\n\n#### \u003ca name=\"strings_substr\"\u003e\u003c/a\u003e Method: `Strings::substr()`\n\nReturns the portion of string specified by the start and length parameters.\n\n```php\n// Returns the portion of string specified by the start 0.\n$string = Strings::substr('SG-1 returns from an off-world mission to P9Y-3C3', 0);\n\n// Returns the portion of string specified by the start 0 and length 4.\n$string = Strings::substr('SG-1 returns from an off-world mission to P9Y-3C3', 0, 4);\n```\n\n#### \u003ca name=\"strings_ucfirst\"\u003e\u003c/a\u003e Method: `Strings::ucfirst()`\n\nConverts the first character of a string to upper case and leaves the other characters unchanged.\n\n```php\n$string = Strings::ucfirst('daniel');\n```\n\n#### \u003ca name=\"strings_trim\"\u003e\u003c/a\u003e Method: `Strings::trim()`\n\nStrip whitespace (or other characters) from the beginning and end of a string.\n\n```php\n$string = Strings::trim(' daniel ');\n```\n\n#### \u003ca name=\"strings_trimRight\"\u003e\u003c/a\u003e Method: `Strings::trimRight()`\n\nStrip whitespace (or other characters) from the end of a string.\n\n```php\n$string = Strings::trimRight('daniel ');\n```\n\n#### \u003ca name=\"strings_trimLeft\"\u003e\u003c/a\u003e Method: `Strings::trimLeft()`\n\nStrip whitespace (or other characters) from the beginning of a string.\n\n```php\n$string = Strings::trimLeft(' daniel');\n```\n\n#### \u003ca name=\"strings_capitalize\"\u003e\u003c/a\u003e Method: `Strings::capitalize()`\n\nConverts the first character of every word of string to upper case and the others to lower case.\n\n```php\n$string = Strings::capitalize('that country was at the same stage of development as the United States in the 1940s');\n```\n\n#### \u003ca name=\"strings_reverse\"\u003e\u003c/a\u003e Method: `Strings::reverse()`\n\nReverses string.\n\n```php\n$string = Strings::reverse('SG-1 returns from an off-world mission');\n```\n\n#### \u003ca name=\"strings_segments\"\u003e\u003c/a\u003e Method: `Strings::segments()`\n\nGet array of segments from a string based on a delimiter.\n\n```php\n// Get array of segments from a string based on a predefined delimiter.\n$segments = Strings::segments('SG-1 returns from an off-world mission');\n\n// Get array of segments from a string based on a delimiter '-'.\n$segments = Strings::segments('SG-1 returns from an off-world mission', '-');\n```\n\n#### \u003ca name=\"strings_segment\"\u003e\u003c/a\u003e Method: `Strings::segment()`\n\nGet a segment from a string based on a delimiter.\nReturns an empty string when the offset doesn't exist.\nUse a negative index to start counting from the last element.\n\n```php\n// Get a segment 1 from a string based on a predefined delimiter.\n$string = Strings::segment('SG-1 returns from an off-world mission', 1);\n\n// Get a segment 1 from a string based on a delimiter '-'.\n$string = Strings::segment('SG-1 returns from an off-world mission', 1, '-');\n\n// Get a segment 1 from a string starting from the last based on a delimiter '-'.\n$string = Strings::segment('SG-1 returns from an off-world mission', -1, '-');\n```\n\n#### \u003ca name=\"strings_firstSegment\"\u003e\u003c/a\u003e Method: `Strings::firstSegment()`\n\nGet the first segment from a string based on a delimiter.\n\n```php\n// Get a first segment from a string based on a predefined delimiter.\n$string = Strings::firstSegment('SG-1 returns from an off-world mission');\n\n// Get a first segment from a string based on a delimiter '-'.\n$string = Strings::firstSegment('SG-1 returns from an off-world mission', '-');\n```\n\n#### \u003ca name=\"strings_lastSegment\"\u003e\u003c/a\u003e Method: `Strings::lastSegment()`\n\nGet the last segment from a string based on a delimiter.\n\n```php\n// Get a last segment from a string based on a predefined delimiter.\n$string = Strings::lastSegment('SG-1 returns from an off-world mission');\n\n// Get a last segment from a string based on a delimiter '-'.\n$string = Strings::lastSegment('SG-1 returns from an off-world mission', '-');\n```\n\n#### \u003ca name=\"strings_between\"\u003e\u003c/a\u003e Method: `Strings::between()`\n\nGet the portion of a string between two given values.\n\n```php\n$string = Strings::between('SG-1 returns from an off-world mission', 'SG-1', 'from');\n```\n\n#### \u003ca name=\"strings_before\"\u003e\u003c/a\u003e Method: `Strings::before()`\n\nGet the portion of a string before the first occurrence of a given value.\n\n```php\n$string = Strings::before('SG-1 returns from an off-world mission', 'mission');\n```\n\n#### \u003ca name=\"strings_beforeLast\"\u003e\u003c/a\u003e Method: `Strings::beforeLast()`\n\nGet the portion of a string before the last occurrence of a given value.\n\n```php\n$string = Strings::beforeLast('SG-1 returns from an off-world mission', 'mission');\n```\n\n#### \u003ca name=\"strings_after\"\u003e\u003c/a\u003e Method: `Strings::after()`\n\nReturn the remainder of a string after the first occurrence of a given value.\n\n```php\n$string = Strings::after('SG-1 returns from an off-world mission', 'SG-1');\n```\n\n#### \u003ca name=\"strings_afterLast\"\u003e\u003c/a\u003e Method: `Strings::afterLast()`\n\nReturn the remainder of a string after the last occurrence of a given value.\n\n```php\n$string = Strings::afterLast('SG-1 returns from an off-world mission', 'SG-1');\n```\n\n#### \u003ca name=\"strings_padBoth\"\u003e\u003c/a\u003e Method: `Strings::padBoth()`\n\nPad both sides of a string with another.\n\n```php\n$string = Strings::padBoth('SG-1 returns from an off-world mission', 50, '-');\n```\n\n#### \u003ca name=\"strings_padRight\"\u003e\u003c/a\u003e Method: `Strings::padRight()`\n\nPad the right side of a string with another.\n\n```php\n$string = Strings::padRight('SG-1 returns from an off-world mission', 50, '-');\n```\n\n#### \u003ca name=\"strings_padLeft\"\u003e\u003c/a\u003e Method: `Strings::padLeft()`\n\nPad the left side of a string with another.\n\n```php\n$string = Strings::padLeft('SG-1 returns from an off-world mission', 50, '-');\n```\n\n#### \u003ca name=\"strings_replaceArray\"\u003e\u003c/a\u003e Method: `Strings::replaceArray()`\n\nReplace a given value in the string sequentially with an array.\n\n```php\n$string = Strings::replaceArray('SG-1 returns from an off-world mission', 'SG-1', ['SG-2']);\n```\n\n#### \u003ca name=\"strings_replaceFirst\"\u003e\u003c/a\u003e Method: `Strings::replaceFirst()`\n\nReplace the first occurrence of a given value in the string.\n\n```php\n$string = Strings::replaceFirst('SG-1 returns from an off-world mission', 'SG-1', 'SG-2');\n```\n\n#### \u003ca name=\"strings_replaceLast\"\u003e\u003c/a\u003e Method: `Strings::replaceLast()`\n\nReplace the last occurrence of a given value in the string.\n\n```php\n$string = Strings::replaceLast('SG-1 returns from an off-world mission', 'off-world', 'P9Y-3C3');\n```\n\n#### \u003ca name=\"strings_start\"\u003e\u003c/a\u003e Method: `Strings::start()`\n\nBegin a string with a single instance of a given value.\n\n```php\n$string = Strings::start('movies/sg-1/season-5/episode-21/', '/');\n```\n\n#### \u003ca name=\"strings_startsWith\"\u003e\u003c/a\u003e Method: `Strings::startsWith()`\n\nDetermine if a given string starts with a given substring.\n\n```php\n$result = Strings::startsWith('/movies/sg-1/season-5/episode-21/', '/');\n```\n\n#### \u003ca name=\"strings_endsWith\"\u003e\u003c/a\u003e Method: `Strings::endsWith()`\n\nDetermine if a given string ends with a given substring.\n\n```php\n$result = Strings::endsWith('/movies/sg-1/season-5/episode-21/', '/');\n```\n\n#### \u003ca name=\"strings_finish\"\u003e\u003c/a\u003e Method: `Strings::finish()`\n\nCap a string with a single instance of a given value.\n\n```php\n$result = Strings::finish('/movies/sg-1/season-5/episode-21', '/');\n```\n\n#### \u003ca name=\"strings_hash\"\u003e\u003c/a\u003e Method: `Strings::hash()`\n\nGenerate a hash string from the input string.\n\n```php\n// Get string hash with predefined settings\n$result = Strings::hash('SG-1 returns from an off-world mission');\n\n// Get string hash with hashed with sha256 algorithm\n$result = Strings::hash('SG-1 returns from an off-world mission', 'sha256');\n\n// Get string hash with hashed with sha256 algorithm and with raw output\n$result = Strings::hash('SG-1 returns from an off-world mission', 'sha256', true);\n```\n\n### License\n[The MIT License (MIT)](https://github.com/flextype-components/strings/blob/master/LICENSE.txt)\nCopyright (c) 2020 [Sergey Romanenko](https://github.com/Awilum)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflextype-components%2Fstrings","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflextype-components%2Fstrings","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflextype-components%2Fstrings/lists"}