Download the PHP package fyre/string without Composer
On this page you can find all versions of the php package fyre/string. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package string
FyreString
FyreString is a free, open-source string manipulation library for PHP.
Table Of Contents
- Installation
- Methods
Installation
Using Composer
In PHP:
Methods
After
Get the contents of a string after the first occurrence of a substring.
$string
is the input string.$search
is a string representing the value to search for.
If the search
string is not found, this method will return the original string.
After Last
Get the contents of a string after the last occurrence of a substring.
$string
is the input string.$search
is a string representing the value to search for.
If the search
string is not found, this method will return the original string.
Before
Get the contents of a string before the first occurrence of a substring.
$string
is the input string.$search
is a string representing the value to search for.
If the search
string is not found, this method will return an empty string.
Before Last
Get the contents of a string before the last occurrence of a substring.
$string
is the input string.$search
is a string representing the value to search for.
If the search
string is not found, this method will return an empty string.
Camel
Convert a string into camelCase.
$string
is the input string.
Capitalize
Capitalize the first character of a string.
$string
is the input string.
Chunk
Split a string into smaller chunks.
$string
is the input string.$size
is a number representing the maximum length of a chunk, and will default to 1.
Contains
Determine whether a string contains a substring.
$string
is the input string.$search
is a string representing the value to search for.
Contains All
Determine whether a string contains all substrings.
$string
is the input string.$searches
is an array containing search strings.
Contains Any
Determine whether a string contains any substring.
$string
is the input string.$searches
is an array containing search strings.
End
Append a substring to a string (if it does not already end with the substring).
$string
is the input string.$search
is a string representing the value to append.
Ends With
Determine whether a string ends with a substring.
$string
is the input string.$search
is a string representing the value to search for.
Escape
Escape characters in a string for use in HTML.
$string
is the input string.$flags
is a number representing the flags to use when escaping, and will default to Str::ENT_QUOTES | Str::ENT_HTML5.
Index Of
Get the position of the first occurrence of a substring within a string.
$string
is the input string.$search
is a string representing the value to search for.$start
is a number representing the starting offset, and will default to 0.
If the search
string is not found, this method will return -1.
Is String
Determine whether the value is a string.
$value
is the value to test.
Kebab
Convert a string into kebab-case.
$string
is the input string.
Last Index Of
Get the position of the last occurrence of a substring within a string.
$string
is the input string.$search
is a string representing the value to search for.$start
is a number representing the starting offset, and will default to 0.
If the search
string is not found, this method will return -1.
Length
Get the length of a string (in bytes).
$string
is the input string.
Limit
Limit a string to a specified number of bytes.
$string
is the input string.$limit
is a number representing the number of bytes to split the string after.$append
is a string representing the value to append if the string is split, and will default to "…".
Lower
Convert a string into lowercase.
$string
is the input string.
Pad
Pad a string to a specified length.
$string
is the input string.$length
is a number representing the desired length.$padding
is a string representing the padding to use, and will default to " ".
Pad End
Pad the end of a string to a specified length.
$string
is the input string.$length
is a number representing the desired length.$padding
is a string representing the padding to use, and will default to " ".
Pad Start
Pad the start of a string to a specified length.
$string
is the input string.$length
is a number representing the desired length.$padding
is a string representing the padding to use, and will default to " ".
Pascal
Convert a string into PascalCase.
$string
is the input string.
Random
Generate a random string.
$length
is the length of the string to generate, and will default to 16.$chars
is a string representing the characters to use, and will default to "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWYXZ0123456789".
Repeat
Repeat a string a specified number of times.
$string
is the input string.$count
is a number representing the number of times to repeat the string.
Replace
Search and replace a value within a string.
$string
is the input string.$search
is a string representing the value to replace.$replace
is a string representing the replacement value.
Replace Array
Search and replace a value within a string.
$string
is the input string.$search
is a string representing the value to replace.$replacements
is an array containing replacement strings.
Replace At
Replace text within a portion of a string.
$string
is the input string.$replace
is a string representing the replacement value.$position
is a number representing the position to replace from.$length
is a number representing the length to replace.
Replace Each
Search and replace key/value pairs within a string.
$string
is the input string.$replacements
is an array containing replacements.
Replace First
Search and replace the first occurrence of a value within a string.
$string
is the input string.$search
is a string representing the value to replace.$replace
is a string representing the replacement value.
Replace Last
Search and replace the last occurrence of a value within a string.
$string
is the input string.$search
is a string representing the value to replace.$replace
is a string representing the replacement value.
Reverse
Reverse the contents of a string.
$string
is the input string.
Shuffle
Shuffle the contents of a string.
$string
is the input string.
Slice
Return a specified portion of a string.
$string
is the input string.$start
is a number representing the starting offset.$length
is a number representing the maximum length to return, and will default to PHP_INT_MAX.
Slug
Format a string for use in a URL.
$string
is the input string.$delimiter
is a string representing the delimiter to use, and will default to "_".
Snake
Convert a string into snake_case.
$string
is the input string.
Split
Split a string by a specified delimiter.
$string
is the input string.$delimiter
is a string representing the delimiter to split by.$limit
is a number representing the maximum number of substrings to return, and will default to PHP_INT_MAX.
Start
Prepend a substring to a string (if it does not already begin with the substring).
$string
is the input string.$search
is a string representing the value to prepend.
Starts With
Determine whether a string begins with a substring.
$string
is the input string.$search
is a string representing the value to search for.
Title
Capitalize the first character of each word in a string.
$string
is the input string.
Transliterate
Transliterate the characters of a string into ASCII.
$string
is the input string.
Trim
Trim whitespace (or other characters) from the start and end of a string.
$string
is the input string.$mask
is a string representing the characters to trim, and will default to " \t\n\r\0\x0B".
Trim End
Trim whitespace (or other characters) from the end of a string.
$string
is the input string.$mask
is a string representing the characters to trim, and will default to \" t\n\r\0\x0B".
Trim Start
Trim whitespace (or other characters) from the start of a string.
$string
is the input string.$mask
is a string representing the characters to trim, and will default to " \t\n\r\0\x0B".
Upper
Convert a string into uppercase.
$string
is the input string.