Blockly.utils. string
Methods
commonWordPrefix
commonWordPrefix(array, opt_shortest) returns number
Given an array of strings, return the length of the common prefix. Words may not be split. Any space after a word is included in the length.
Parameter |
|
---|---|
array |
Array of string Array of strings. Value must not be null. |
opt_shortest |
Optional number Length of shortest string. |
- Returns
-
number
Length of common prefix.
commonWordSuffix
commonWordSuffix(array, opt_shortest) returns number
Given an array of strings, return the length of the common suffix. Words may not be split. Any space after a word is included in the length.
Parameter |
|
---|---|
array |
Array of string Array of strings. Value must not be null. |
opt_shortest |
Optional number Length of shortest string. |
- Returns
-
number
Length of common suffix.
shortestStringLength
shortestStringLength(array) returns number
Given an array of strings, return the length of the shortest one.
Parameter |
|
---|---|
array |
Array of string Array of strings. Value must not be null. |
- Returns
-
number
Length of shortest string.
startsWith
startsWith(str, prefix) returns boolean
Fast prefix-checker. Copied from Closure's goog.string.startsWith.
Parameter |
|
---|---|
str |
string The string to check. |
prefix |
string A string to look for at the start of |
- Returns
-
boolean
True ifstr
begins withprefix
.
wrap
wrap(text, limit) returns string
Wrap text to the specified width.
Parameter |
|
---|---|
text |
string Text to wrap. |
limit |
number Width to wrap each line. |
- Returns
-
string
Wrapped text.