utils.string
namespace string
a collection of string utility functions
Summary
Public Methods
capitalize(str: string) → {string}
converts the first character of the given string to uppercase
Name | Type | Description |
---|---|---|
str | string |
the string to be capitalized |
Type | Description |
---|---|
string |
the capitalized string |
isBoolean(str: string) → {boolean}
returns true if the given string contains a true or false
Name | Type | Description |
---|---|---|
str | string |
the string to be tested |
Type | Description |
---|---|
boolean |
true if the string is either true or false |
isDataUrl(str: string) → {boolean}
returns true if the given string is a data url in the data:[<mediatype>][;base64],<data>
format.
(this will not test the validity of the Data or Base64 encoding)
Name | Type | Description |
---|---|---|
str | string |
the string (url) to be tested |
Type | Description |
---|---|
boolean |
true if the string is a data url |
isNumeric(str: string) → {boolean}
returns true if the given string contains a numeric integer or float value
Name | Type | Description |
---|---|---|
str | string |
the string to be tested |
Type | Description |
---|---|
boolean |
true if string contains only digits |
toHex(str: string) → {string}
convert a string to the corresponding hexadecimal value
Name | Type | Description |
---|---|---|
str | string |
the string to be converted |
Type | Description |
---|---|
string |
the converted hexadecimal value |