-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Some ideas from the following links:
- https://www.php.net/manual/en/ref.strings.php
- https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html
- https://hush-shell.github.io/std.html
- abbreviate - abbreviates a string using ellipses or another given String
- addcslashes — Quote string with slashes in a C style
- addslashes — Quote string with slashes
- appendIfMissing - appends a suffix to the end of the String if not present
- args() - Gets an array of command line arguments.
- assert(value) - Asserts that value is true, panics otherwise.
- base64.decode(string) - Parse the given base64 string. Returns an error if parsing fails.
- base64.encode(string) - Convert the given value to a base64 string.
- bin2hex — Convert binary data into hexadecimal representation
- bind(obj, function) - Returns a new function that binds function to obj, so that self will always refer to obj when the function is called.
- bytes(string) - Convert the given string to an array of chars.
- catch(function) - Runs the given function, and returns an error if it panics. This should be used sparingly, as panics shouldn't be used for recoverable errors.
- cd(dir) - Change the current directory to dir.
- chomp/Chop - removes the last part of a String
- chop — Alias of rtrim
- chr — Generate a single-byte string from a number
- chunk_split — Split a string into smaller chunks
- contains(collection, value) - Checks if collection contains an item that is equal to value. May be used with strings, arrays and dicts.
- containsOnly/ContainsNone/ContainsAny - checks if String contains only/none/any of these characters
- convert_uudecode — Decode a uuencoded string
- convert_uuencode — Uuencode a string
- countMatches - counts the number of occurrences of one String in another
- count_chars — Return information about characters used in a string
- crc32 — Calculates the crc32 polynomial of a string
- crypt — One-way string hashing
- cwd() - Returns the current working directory.
- defaultString - protects against a null input String
- difference - compares Strings and reports on their differences
- endsWith - check if a String ends with a suffix in a null-safe manner
- env(key) - Gets the value of the environment variable key, or nil if it's not defined.
- equals/Compare - compares two strings in a null-safe manner
- error(description, context) - Create a new error with the given description and context. The description must be a string.
- exit(int) - Terminates execution immediately with the given status code. Panics if the status code is not in the range [0, 255].
- explode — Split a string by a string
- export(key, value) - Set the environment variable key to value. Both arguments must be strings.
- float(value) - Convert value to float. Accepts string, int and float.
- glob(path) - Expands the given path in the current directory, using the shell expansion rules (*, %, etc).
- has_error(value) - Recursively checks if value contains a value of type error.
- hex.decode(string) - Parse the given hex string. Returns an error if parsing fails.
- hex.encode(string) - Convert the given value to a hex string.
- hex2bin — Decodes a hexadecimally encoded binary string
- html_entity_decode — Convert HTML entities to their corresponding characters
- htmlentities — Convert all applicable characters to HTML entities
- htmlspecialchars — Convert special characters to HTML entities
- htmlspecialchars_decode — Convert special HTML entities back to characters
- implode — Join array elements with a string
- import(path) - Load the Hush script from the given path, relative to the current file.
- indexOf/LastIndexOf/Contains - null-safe index-of checks
- indexOfAny/LastIndexOfAny/IndexOfAnyBut/LastIndexOfAnyBut - index-of any of a set of Strings
- int(value) - Convert value to int. Accepts string, int and float.
- isAlpha/IsNumeric/IsWhitespace/IsAsciiPrintable - checks the characters in a String
- isEmpty/IsBlank - checks if a String contains text
- is_empty(collection) - Checks if the given collection is empty. Accepts strings, arrays and dicts.
- iter(collection) - Returns an iterator function for the given collection. Accepts strings, arrays and dicts.
- join — Alias of implode
- json.decode(string) - Parse the given json string. Returns an error if parsing fails.
- json.encode(value) - Convert the given value to a JSON string. Panics if value contains a value that cannot be serialized as JSON (function or error).
- lcfirst — Make a string's first character lowercase
- leftPad/RightPad/Center/Repeat - pads a String
- len(collection) - Returns the amount of elements in the given collection. Accepts strings, arrays and dicts.
- levenshtein — Calculate Levenshtein distance between two strings
- levenshteinDistance - the number of changes needed to change one String into another
- localeconv — Get numeric formatting information
- ltrim — Strip whitespace (or other characters) from the beginning of a string
- match(string): returns a bool indicating whether the pattern matches the given string.
- metaphone — Calculate the metaphone key of a string
- money_format — Formats a number as a currency string
- nl2br — Inserts HTML line breaks before all newlines in a string
- nl_langinfo — Query language and locale information
- number_format — Format a number with grouped thousands
- ord — Convert the first byte of a string to a value between 0 and 255
- panic(value) - Panics with the given value as description.
- parse_str — Parses the string into variables
- pop(array) - Removes the last element from the given array, returning it. Panics if the array is empty.
- prependIfMissing - prepends a prefix to the start of the String if not present
- print(value) - Prints the given value to ut, including a newline.
- push(array, value) - Adds the given value to the end of array.
- quoted_printable_decode — Convert a quoted-printable string to an 8 bit string
- quoted_printable_encode — Convert a 8 bit string to a quoted-printable string
- quotemeta — Quote meta characters
- range(from, to, step) - Returns an iterator function that yields numbers in the given range.
- read(prompt) - Read a line from n, using the given prompt, which must be a string.
- regex(pattern) - Build a regex object from pattern, which must be a string. If pattern is not a valid regex, an error will be returned. Otherwise, returns a dict with the following methods:
- remove/Delete - removes part of a String
- replace(string, replace): returns a string with replaced occurrences of pattern in string. replace must be a string.
- replace(string, seach, replace) - Replace occurrences of search with replace in string. All parameters must be strings.
- replace/Overlay - Searches a String and replaces one String with another
- reverse/ReverseDelimited - reverses a String
- rotate - rotate (circular shift) a String
- rtrim — Strip whitespace (or other characters) from the end of a string
- setlocale — Set locale information
- similar_text — Calculate the similarity between two strings
- sleep(ms) - Sleep for the given amount of milliseconds. Accepts positive integers only.
- sort(array) - Sorts the given array.
- soundex — Calculate the soundex key of a string
- split(string): splits string using the pattern, returning an array of strings.
- split(string, pattern) - Splits the given string by occurrences of pattern, returning a non-empty array. Both arguments must be strings.
- split/Join - splits a String into an array of substrings and vice versa
- sscanf — Parses input from a string according to a format
- startsWith - check if a String starts with a prefix in a null-safe manner
- str_contains — Determine if a string contains a given substring
- str_ends_with — Checks if a string ends with a given substring
- str_getcsv — Parse a CSV string into an array
- str_ireplace — Case-insensitive version of str_replace
- str_pad — Pad a string to a certain length with another string
- str_repeat — Repeat a string
- str_replace — Replace all occurrences of the search string with the replacement string
- str_rot13 — Perform the rot13 transform on a string
- str_shuffle — Randomly shuffles a string
- str_split — Convert a string to an array
- str_starts_with — Checks if a string starts with a given substring
- str_word_count — Return information about words used in a string
- strcasecmp — Binary safe case-insensitive string comparison
- strchr — Alias of strstr
- strcmp — Binary safe string comparison
- strcoll — Locale based string comparison
- strcspn — Find length of initial segment not matching mask
- strip_tags — Strip HTML and PHP tags from a string
- stripcslashes — Un-quote string quoted with addcslashes
- stripos — Find the position of the first occurrence of a case-insensitive substring in a string
- stripslashes — Un-quotes a quoted string
- stristr — Case-insensitive strstr
- strlen — Get string length
- strnatcasecmp — Case insensitive string comparisons using a "natural order" algorithm
- strnatcmp — String comparisons using a "natural order" algorithm
- strncasecmp — Binary safe case-insensitive string comparison of the first n characters
- strncmp — Binary safe string comparison of the first n characters
- strpbrk — Search a string for any of a set of characters
- strpos — Find the position of the first occurrence of a substring in a string
- strrchr — Find the last occurrence of a character in a string
- strrev — Reverse a string
- strripos — Find the position of the last occurrence of a case-insensitive substring in a string
- strrpos — Find the position of the last occurrence of a substring in a string
- strspn — Finds the length of the initial segment of a string consisting entirely of characters contained within a given mask
- strstr — Find the first occurrence of a string
- strtok — Tokenize string
- strtolower — Make a string lowercase
- strtoupper — Make a string uppercase
- strtr — Translate characters or replace substrings
- substr — Return part of a string
- substr(string, from, length) - Slice the given string. The two last parameters must be positive integers.
- substr_compare — Binary safe comparison of two strings from an offset, up to length characters
- substr_count — Count the number of substring occurrences
- substr_replace — Replace text within a portion of a string
- substring/Left/Right/Mid - null-safe substring extractions
- substringBefore/SubstringAfter/SubstringBetween - substring extraction relative to other strings
- to_string(value) - Converts the given value to string.
- trim — Strip whitespace (or other characters) from the beginning and end of a string
- try_typecheck(value, type) - Checks if the given value has type type, returns an error otherwise. type must be a string.
- type(value) - Returns a string describing the type of value: "nil", "bool", "char", "int", "float", "string", "array", "dict", "function", or "error".
- typecheck(value, type) - Checks if the given value has type type, panics otherwise. type must be a string.
- ucfirst — Make a string's first character uppercase
- ucwords — Uppercase the first character of each word in a string
- upperCase/LowerCase/SwapCase/Capitalize/Uncapitalize - changes the case of a String
- utf8_decode — Converts a string from UTF-8 to ISO-8859-1, replacing invalid or unrepresentable characters
- utf8_encode — Converts a string from ISO-8859-1 to UTF-8
- wordwrap — Wraps a string to a given number of characters
Metadata
Metadata
Assignees
Labels
No labels