str
Last updated
Last updated
The str extension contains string helper function for validation and comparison.
Returns the size/length of a string. If the supplied value isn't a string, -1 is returned.
str.size(value)
Name | Type | Description |
---|---|---|
Returns true
if the supplied value is a string, otherwise false
.
str.isString(value)
Returns true
if the supplied value is null
/undefined
or an empty string (""
).
str.isNullOrEmpty(value)
Returns true
if the supplied value is a string and is not null
/undefined
or empty (""
).
str.isNotNullOrEmpty(value)
Returns true
if the supplied values are strings with identical content, possible with different case.
str.isEqual(s1, s2[, ignoreCase])
Returns true
if the supplied values are strings with identical content, always ignoring different case.
This function is equivalent to str.isEqual(s1, s2, true)
str.isEqualIgnoreCase(s1, s2)
Returns true
if the supplied value match any of the supplied regular expressions (regex).
str.matchAny(value, regex[,regex, ...])
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
value
string
The string whose length is calculated and returned. If empty, 0
is returned. If null, undefined or not a string, -1
is returned.
value
string
The value to check
value
string
The value to check
value
string
The value to check
s1
string
The first string to compare for equality
s2
string
The second string to compare for equality
ignoreCase
boolean
Flag turning on case-insensitive compare (default: false
)
s1
string
The first string to compare for equality
s2
string
The second string to compare for equality
value
string
The value to match
regex
string | regex
One or more regular expressions used for matching.