-
-
Notifications
You must be signed in to change notification settings - Fork 0
Feature: Type: String
Аниса edited this page Sep 9, 2022
·
4 revisions
JS provides built in String
module by default, however its deprived of certain functions that may usually be needed (formatting and such). Not to mention default string APIs also doesn't support numeric inputs, while Vital.kit's implementation does!
Our extensions are written with backwards compatibility in mind; Expect your previous code to work as usual! However we recommend upgrading to newer syntax.
You can also provide a number as
value
to below APIs and expect it work similar to string values; Returns will be automatically converted to your input's type!
const string: result = vKit.String(
~: value
)
const bool: result = vKit.String.isVoid(
string: value
)
const string: result = vKit.String.sub(
string: value,
int: startIndex,
int: endIndex
)
const string: result = vKit.String.replace(
string: value,
string: matchValue, // Regex is supported too
string: replaceValue
)
const string: result = vKit.String.match(
string: value,
string: matchValue // Regex is supported too
)
const string: result = vKit.String.format(
string: value,
~: ...arguments
)
// Example:
rwText = vKit.String("My name is %0, I am from %1.", "Anisa", "Russia")
const array: result = vKit.String.split(
string: value,
string: separator
)
const string: result = vKit.String.detab(
string: value
)