A set of utility functions for string manipulation.
Add @aceworks-studio/string
in your dependencies:
yarn add @aceworks-studio/string
Or if you are using npm
:
npm install @aceworks-studio/string
function contains(value: string, substring: string): boolean
Checks if the given string value
contains substring
.
function endsWith(value: string, suffix: string): boolean
Checks if the given string value
ends with the specified suffix suffix
. Returns true
if value
ends with suffix
, otherwise false
.
function startsWith(value: string, prefix: string): boolean
Checks if the given string value
starts with the specified prefix prefix
. Returns true
if value
starts with prefix
, otherwise false
.
function trim(value: string): string
Removes whitespace from both ends of the given string. Returns the trimmed string.
function trimEnd(value: string): string
Removes whitespace from the end of the given string. Returns the trimmed string.
function trimStart(value: string): string
Removes whitespace from the beginning of the given string. Returns the trimmed string.
This project is available under the MIT license. See LICENSE.txt for details.
If you would like to use this library on a Lua environment where it is currently incompatible, open an issue (or comment on an existing one) to request the appropriate modifications.
The library uses darklua to process its code.