String - nsrosenqvist/quickscript GitHub Wiki

String

trim_whitespace()

trim_whitespace() 

Trims all trailing and leading whitespace

Parameter Explanation
$1 (string) The string to trim

return (string) - The trimmed string

author: Niklas Rosenqvist


trim_leading_whitespace()

trim_leading_whitespace() 

Trims all leading whitespace

Parameter Explanation
$1 (string) The string to trim

return (string) - The trimmed string

author: Niklas Rosenqvist


trim_trailing_whitespace()

trim_trailing_whitespace() 

Trims all trailing whitespace

Parameter Explanation
$1 (string) The string to trim

return (string) - The trimmed string

author: Niklas Rosenqvist


string_replace()

string_replace() 

Replaces the first substring within a string

Parameter Explanation
$1 (string) The haystack
$2 (string) The string to replace with

return (string) - The string with the substition taken place

author: Niklas Rosenqvist


string_replace_all()

string_replace_all() 

Replaces all occurrences of a substring within a string

Parameter Explanation
$1 (string) The haystack
$2 (string) The string to replace with

return (string) - The string with the substition taken place

author: Niklas Rosenqvist


string_ireplace()

string_ireplace() 

Replaces the first substring within a string, case-insensitive

Parameter Explanation
$1 (string) The haystack
$2 (string) The string to replace with

return (string) - The string with the substition taken place

author: Niklas Rosenqvist


string_ireplace_all()

string_ireplace_all() 

Replaces all occurrences of a substring within a string, case-insensitive

Parameter Explanation
$1 (string) The haystack
$2 (string) The string to replace with

return (string) - The string with the substition taken place

author: Niklas Rosenqvist


substring()

substring() 

Extracts a substring from a string

Parameter Explanation
$2 (int) Optionally the position to end at
$1 (string) String to extract the substring from

return (string) - The extracted string

author: Niklas Rosenqvist


to_uppercase()

to_uppercase() 

Converts a string to uppercase

Parameter Explanation
$1 (string) String to change case

return (string) - The string but in all uppercase letters

author: Niklas Rosenqvist


to_lowercase()

to_lowercase() 

Converts a string to lowercase

Parameter Explanation
$1 (string) String to change case

return (string) - The string but in all lowercase letters

author: Niklas Rosenqvist


capitalize()

capitalize() 

Capitalizes the first letter in the word

Parameter Explanation
$1 (string) String to capitalize

return (string) - The string but with the first letter capitalized

author: Niklas Rosenqvist


⚠️ **GitHub.com Fallback** ⚠️