@aceworks-studio/string
A set of utility functions for string manipulation.
Installation
Add @aceworks-studio/string
in your dependencies:
yarn add @aceworks-studio/string
Or if you are using npm
:
npm install @aceworks-studio/string
Content
contains
function contains(value: string, substring: string): boolean
Checks if the given string value
contains substring
.
endsWith
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
.
startsWith
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
.
trim
function trim(value: string): string
Removes whitespace from both ends of the given string. Returns the trimmed string.
trimEnd
function trimEnd(value: string): string
Removes whitespace from the end of the given string. Returns the trimmed string.
trimStart
function trimStart(value: string): string
Removes whitespace from the beginning of the given string. Returns the trimmed string.
License
This project is available under the MIT license. See LICENSE.txt for details.
Other Lua Environments Support
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.