- Source:
String-based type functionality.
Methods
[mixin]
ish.type.str.atob(x) → {string}
- Source:
- See:
-
Creates a Base64-encoded ASCII string from a binary string (i.e., a string in which each character in the string is treated as a byte of binary data).
From Mixin: ish.type-ex.js
must be included for ishJS
to access this functionality.
Parameters:
Name |
Type |
Description |
x |
variant
|
Value representing the binary string containing base64-encoded data. |
Returns:
Type |
Description |
string
|
Value representing the the results of the passed value's Base64 decoded data. |
[mixin]
ish.type.str.begins(x, vReference) → {boolean|integer}
- Source:
Compares the passed value to the reference value, determining if it begins with, begins with when case-insensitive and trimmed or does not begin with the reference value.
From Mixin: ish.type-ex.js
must be included for ishJS
to access this functionality.
Parameters:
Name |
Type |
Description |
x |
variant
|
Value representing the string to compare. |
vReference |
variant
|
Array.<variant>
|
Value representing the reference string(s) to compare to. |
Returns:
Type |
Description |
boolean
|
integer
|
Value representing if the passed value begins with (true ), begins with when case-insensitive and trimmed (1 ) or does not begin with (false ) to the passed reference value. |
[mixin]
ish.type.str.btoa(encodedData) → {string}
- Source:
- See:
-
Decodes a Base64-encoded ASCII string of data which has been encoded using Base64 encoding.
From Mixin: ish.type-ex.js
must be included for ishJS
to access this functionality.
Parameters:
Name |
Type |
Description |
encodedData |
string
|
Value representing the binary string. |
Returns:
Type |
Description |
string
|
Value representing the results of the passed value's Base64 representation. |
[mixin]
ish.type.str.cmp(x, vReference) → {boolean|integer}
- Source:
Compares the passed value to the reference value(s), determining if it is equal, equal when case-insensitive and trimmed or not equal.
From Mixin: ish.type-ex.js
must be included for ishJS
to access this functionality.
Parameters:
Name |
Type |
Description |
x |
variant
|
Value representing the string to compare. |
vReference |
variant
|
Array.<variant>
|
Value representing the reference string(s) to compare to. |
Returns:
Type |
Description |
boolean
|
integer
|
Value representing if the passed value is equal (true ), equal when case-insensitive and trimmed (1 ) or not equal (false ) to the passed reference string(s). |
[mixin]
ish.type.str.contains(x, vReference) → {boolean|integer}
- Source:
Compares the passed value to the reference value, determining if it is contained within, contained within when case-insensitive and trimmed or is not contained within with the reference value.
From Mixin: ish.type-ex.js
must be included for ishJS
to access this functionality.
Parameters:
Name |
Type |
Description |
x |
variant
|
Value representing the string to compare. |
vReference |
variant
|
Array.<variant>
|
Value representing the reference string(s) to compare to. |
Returns:
Type |
Description |
boolean
|
integer
|
Value representing if the passed value is contained within (true ), contained within when case-insensitive and trimmed (1 ) or is not contained within (false ) to the passed reference value. |
[mixin]
ish.type.str.ends(x, vReference) → {boolean|integer}
- Source:
Compares the passed value to the reference value, determining if it ends with, ends with when case-insensitive and trimmed or does not end with the reference value.
From Mixin: ish.type-ex.js
must be included for ishJS
to access this functionality.
Parameters:
Name |
Type |
Description |
x |
variant
|
Value representing the string to compare. |
vReference |
variant
|
Array.<variant>
|
Value representing the reference string(s) to compare to. |
Returns:
Type |
Description |
boolean
|
integer
|
Value representing if the passed value ends with (true ), ends with when case-insensitive and trimmed (1 ) or does not end with (false ) to the passed reference value. |
[mixin]
ish.type.str.eq(x, y, bCaseInsensitiveopt) → {boolean}
- Source:
Determines if the passed values are equal.
From Mixin: ish.type-ex.js
must be included for ishJS
to access this functionality.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
x |
variant
|
|
|
Value to interrogate. |
y |
variant
|
|
|
Value to interrogate. |
bCaseInsensitive |
boolean
|
<optional>
|
true
|
Value representing if the keys are to be searched for in a case-insensitive manor. |
Returns:
Type |
Description |
boolean
|
Value representing if the passed values are equal. |
ish.type.str.is(x, bDisallowNullStringopt, bTrimWhitespaceopt) → {boolean}
- Source:
Determines if the passed value represents a string.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
x |
variant
|
|
|
Value to interrogate. |
bDisallowNullString |
boolean
|
<optional>
|
false
|
Value representing if null-strings (e.g. "") are to be disallowed. |
bTrimWhitespace |
boolean
|
<optional>
|
false
|
Value representing if leading and trailing whitespace is to be trimmed prior to integration. |
Returns:
Type |
Description |
boolean
|
Value representing if the passed value represents a string. |
ish.type.str.is.json(x) → {boolean}
- Source:
Determines if the passed value is valid JSON.
Parameters:
Name |
Type |
Description |
x |
variant
|
Value to interrogate. |
Returns:
Type |
Description |
boolean
|
Value representing if the passed value is a valid JSON string. |
[client]
ish.type.str.is.selector(x) → {boolean}
- Source:
- See:
-
Determines if the passed value is a valid CSS selector.
Client-Side Only: This functionality is only available under a browser (Firefox, Chrome, etc.).
Parameters:
Name |
Type |
Description |
x |
variant
|
Value to interrogate. |
Returns:
Type |
Description |
boolean
|
Value representing if the passed value is a valid CSS selector. |
[mixin]
ish.type.str.lpad(x, sChar, iLength) → {string}
- Source:
Prepends the passed character onto the passed value to a minimum length.
From Mixin: ish.type-ex.js
must be included for ishJS
to access this functionality.
Parameters:
Name |
Type |
Description |
x |
variant
|
Value representing the string to pad. |
sChar |
string
|
Value representing the character to pad with. |
iLength |
integer
|
Value representing the minimum length to pad to. |
Returns:
Type |
Description |
string
|
Value representing the passed value prepended with the pad character to the minimum length. |
ish.type.str.mk(x, vDefaultValopt) → {string}
- Source:
Casts the passed value into a string.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
x |
variant
|
|
|
Value to interrogate. |
vDefaultVal |
variant
|
<optional>
|
""
|
Value representing the default return value if casting fails. |
Returns:
Type |
Description |
string
|
Value representing the passed value as a string type. |
[mixin]
ish.type.str.replace(x, oData, oOptionsopt) → {string}
- Source:
Interpolates variables within the passed value.
From Mixin: ish.type-ex.js
must be included for ishJS
to access this functionality.
Parameters:
Name |
Type |
Attributes |
Description |
x |
variant
|
|
Value representing the string. |
oData |
object
|
|
Value representing the data to interpolate within the passed value. |
oOptions |
object
|
<optional>
|
Value representing the following options:
Properties
Name |
Type |
Attributes |
Default |
Description |
pattern |
RegExp
|
<optional>
|
|
Value representing the regular expression that defines the interpolation delimiters. |
start |
boolean
|
<optional>
|
"{"
|
Value representing the leading interpolation delimiter. |
end |
boolean
|
<optional>
|
"}"
|
Value representing the trailing interpolation delimiter. |
|
Returns:
Type |
Description |
string
|
Value representing the results of the passed value's interpolation. |
[mixin]
ish.type.str.rpad(x, sChar, iLength) → {string}
- Source:
Appends the passed character onto the passed value to a minimum length.
From Mixin: ish.type-ex.js
must be included for ishJS
to access this functionality.
Parameters:
Name |
Type |
Description |
x |
variant
|
Value representing the string to pad. |
sChar |
string
|
Value representing the character to pad with. |
iLength |
integer
|
Value representing the minimum length to pad to. |
Returns:
Type |
Description |
string
|
Value representing the passed value appended with the pad character to the minimum length. |
[mixin]
ish.type.str.sub(x, iFromStart, iFromEnd) → {string}
- Source:
Removes the referenced leading and trailing characters from the passed value.
From Mixin: ish.type-ex.js
must be included for ishJS
to access this functionality.
Parameters:
Name |
Type |
Description |
x |
variant
|
Value representing the string. |
iFromStart |
integer
|
Value representing the number of characters to remove from the beginning of the passed value. |
iFromEnd |
integer
|
Value representing the number of characters to remove from the end of the passed value. |
Returns:
Type |
Description |
string
|
Value representing the remaining characters from the passed value. |