camelize
Parameters:
- string
- lowercased
Converts string to camelcase notation. Second parameter sets the first letter to lowercase or uppercase.
capitalize
Parameters:
- string
Converts first letter of the string to uppercase.
celsius
Parameters:
- string
Converts temperature in Fahrenheit and Kelvin notation to Celsius degree. When passed string is a number, appends °C to the string.
chomp
Parameters:
- string
- pattern
Removes from the end of the string passed pattern.
chop
Parameters:
- string
Returns string with last character removed. If the string ends with line ending characters then both will be removed.
classify
Parameters:
- string
Creates a class name based on the string.
constantize
Parameters:
- string
Converts string to constant notation.
crop
Parameters:
- string
- length
- append
Truncates string at full words. Adds ... if the string is longer than the second parameter.
dasherize
Parameters:
- string
Replaces _ with -.
dot
Parameters:
- string
Returns string with dot at the end.
fahrenheit
Parameters:
- string
Converts temperature in Celsius and Kelvin notation to Fahrenheit degree. When passed string is a number, appends °F to the string.
htmlstrip
Parameters:
- string
Removes HTML tags from a string. Warning: user input might include malicious content, htmlstrip is not a silver bullet against xss.
humanize
Parameters:
- string
- capitalize = true
Replaces _ with singlespaces. When capitalize is truthy, converts first char of the string to uppercase.
hyphenate
Parameters:
- string
Replaces spaces with hyphens, splits camelcase text, remove non-word chars and converts string to lowercase.
index
Parameters:
- string
- pattern
- start = 0
Returns index of searched pattern.
initials
Parameters:
- string
- separator = ""
Returns initials separated by the separator.
kelvin
Parameters:
- string
Converts temperature in Celsius and Fahrenheit notation to Kelvin scale. When passed string is a number, appends K to the string.
lowercase
Parameters:
- string
Lowercases the string.
lowerfirst
Parameters:
- string
Converts first letter of the string to lowercase.
ltrim
Parameters:
- string
- characters = " "
Removes white space characters or other specified in parameter characters from the beginning of the string.
pad
Parameters:
- string
- pad
- left = true
Returns string with added pad from left side or right side.
pluralize
Parameters:
- string
Returns plural form of the string.
repeat
Parameters:
- string
- count
Repeats the string n times.
replace
Parameters:
- string
- pattern
- replace
Replaces searched pattern by the last parameter.
rtrim
Parameters:
- string
- characters = " "
Removes white space characters or other specified in parameter characters from the end of the string.
singlespace
Parameters:
- string
Replaces in the string multiple spaces to single spaces.
singularize
Parameters:
- string
- appendix = ""
Returns singular form of the string.
slugify
Parameters:
- string
- separator = "-"
Converts string to lower case, remove non-word chars and replace spaces with the separator.
split
Parameters:
- string
- separator = ""
Splits string into an array by separating the string into substrings.
strip
Parameters:
- string
- pattern
Removes the passed pattern from the string.
squeeze
Parameters:
- string
- pattern = "a-zA-Z"
Replaces multiple occurances of the same characters to the one character.
summarize
Parameters:
- string
- length = 100
Adds three dots at the end of the string, when the string is longer than the passed length.
swapcase
Parameters:
- string
Replaces in string lowercased letters to uppercase and uppercased letters to lowercase.
tail
Parameters:
- string
- length = 30
- ending = "..."
Truncates the tail of a given string.
titleize
Parameters:
- string
Converts to 'uppercase' first letter of each word in string.
trim
Parameters:
- string
Removes whitespace from the start and the end of the string.
truncate
Parameters:
- string
- length = 30
- ending = "..."
Truncates a given string if it longer than the passed length and replaces last chars of new string with the passed ending.
quote
Parameters:
- string
- lang = "en"
Puts the string inside quotations marks.
uid
Parameters:
- length = 32
Returns an unique identifier.
underscore
Parameters:
- string
Returns new string with words separated by _. All letters are lowercased.
unquote
Parameters:
- string
Removes "" or „” from the string.
unwrap
Parameters:
- string
- first
- last = first
Removes characters from the start and end of the string based on the passed values.
uppercase
Parameters:
- string
Converts string to uppercase.
unescape
Parameters:
- string
Converts the HTML entities to their corresponding characters.
whitespacestrip
Parameters:
- string
Removes whitespaces from the string.
wrap
Parameters:
- string
- first
- last = first
Wraps string between the first and last parameters.
bytes
Parameters:
- string
Converts string with specific unit to bytes.
prettybytes
Parameters:
- bytes
Converts bytes to a human-readable string with binary units (KiB, MiB, GiB, etc.).