String tools.
- Copyright:
- Mat. 2018-present
- License:
- Apache-2.0
- Source:
- Copyright:
- Mat. 2018-present
- License:
- Apache-2.0
- Source:
- Copyright:
- Mat. 2018-present
- License:
- Apache-2.0
- Source:
Methods
(inner) asciiLetters() → {String}
Return full set of ASCII letters.
- Source:
Returns:
- Type:
-
String
(inner) asciiLowercase() → {String}
Return lowercase ASCII letters.
- Source:
Returns:
- Type:
-
String
(inner) asciiUppercase() → {String}
Return uppercase ASCII letters.
- Source:
Returns:
- Type:
-
String
(inner) big(n, copt) → {String}
Allocate a big string (of size 2^n). Use with caution!
big(16)makes2^16 = 65536string size.big(23)makes2^23 = 8Mstring size,big(24)makes16Mand so on.
c = "x" - Character used during string generation.
Example:
big(2) === "xxxx"
big(3, "a") === "aaaaaaaa"
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
n |
||||
c |
<optional> |
"x" |
Returns:
- Type:
-
String
(inner) camelToPascal(str) → {String}
Convert thisKindOfText to ThisKindOfText.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
str |
String
|
Returns:
- Type:
-
String
(inner) camelToSnake(str) → {String}
Convert thisKindOfText to this_kind_of_text.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
str |
String
|
Returns:
- Type:
-
String
(inner) capitalize(str) → {String}
Ensure given string is in form Aaaaaaaa.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
str |
String
|
Returns:
- Type:
-
String
(inner) digits() → {String}
Return all digits.
- Source:
Returns:
- Type:
-
String
(inner) ellipsis(str, placingopt, sepopt) → {String}
Constructs new string with inserted sep (of default value …)
at the ellipsis.BEGIN, ellipsis.MIDDLE or ellipsis.END.
Returned string has the same length as input string
(thus some original characters are replaced with sep contents).
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
str |
String
|
Text to insert |
||
placing |
Number
|
<optional> |
ellipsis.MIDDLE |
Place to insert.
Can be |
sep |
String
|
<optional> |
"…" |
Separator. |
Returns:
- Type:
-
String
(inner) empty() → {String}
Construct empty string.
- Source:
Returns:
- Type:
-
String
(inner) padLeft(input, len, spaceopt) → {String}
Prepend given input string with an appropriate amount of
ch characters so that returning string length is equal to len.
If len is smaller than length of input then input is being
returned untouched (padding doesn't shorten the input).
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
input |
String
|
|||
len |
Number
|
|||
space |
String
|
<optional> |
" " |
Returns:
- Type:
-
String
(inner) padRight(input, len, spaceopt) → {String}
Append an appropriate amount of ch characters to the given input
string so that returning string length is equal to len.
If len is smaller than length of input then input is being
returned untouched (padding doesn't shorten the input).
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
input |
String
|
|||
len |
Number
|
|||
space |
String
|
<optional> |
" " |
Returns:
- Type:
-
String
(inner) pascalToCamel(str) → {String}
Convert ThisKindOfText to thisKindOfText.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
str |
String
|
Returns:
- Type:
-
String
(inner) pascalToSnake(str) → {String}
Convert ThisKindOfText to this_kind_of_text.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
str |
String
|
Returns:
- Type:
-
String
(inner) quote(stropt, qopt) → {String}
Quote text.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
str |
String
|
<optional> |
empty() | |
q |
String
|
<optional> |
"\"\"" |
Returns:
- Type:
-
String
(inner) random(sizeopt, lettersopt) → {String}
Construct random string of desired length.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
size |
<optional> |
0 | ||
letters |
<optional> |
asciiLetters()+digits() |
Returns:
- Type:
-
String
(inner) shorten(str, lenopt, placingopt, sepopt) → {String}
Constructs new string not longer than len.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
str |
String
|
Text to be shortened. |
||
len |
Number
|
<optional> |
Infinity |
Desired text length. |
placing |
Number
|
<optional> |
shorten.MIDDLE |
Character cutting place.
Can be |
sep |
String
|
<optional> |
"…" |
Separator. |
Returns:
- Type:
-
String
(inner) snakeToCamel(str) → {String}
Convert this_kind_of_text to thisKindOfText.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
str |
String
|
Returns:
- Type:
-
String
(inner) snakeToPascal(str) → {String}
Convert this_kind_of_text to ThisKindOfText.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
str |
String
|
Returns:
- Type:
-
String
(inner) wrap(stropt, prefixopt, suffixopt) → {String}
Wrap passed string with prefix and suffix.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
str |
String
|
<optional> |
empty() | |
prefix |
String
|
<optional> |
empty() | |
suffix |
String
|
<optional> |
empty() |
Returns:
- Type:
-
String