strings.js is part of Aloha Editor project http://www.alohaeditor.org
Aloha Editor ● JavaScript Content Editing Library
Copyright (c) 2010-2015 Gentics Software GmbH, Vienna, Austria.
Contributors http://www.alohaeditor.org/docs/contributing.html
Reference:
http://www.w3.org/TR/html401/struct/text.html
Aloha Editor ● JavaScript Content Editing Library
Copyright (c) 2010-2015 Gentics Software GmbH, Vienna, Austria.
Contributors http://www.alohaeditor.org/docs/contributing.html
Reference:
http://www.w3.org/TR/html401/struct/text.html
Members
-
camelCaseToDashes
-
Converts a camel cased form into dashes form.
The given string should begin with a lowercase letter and should not
contain dashes.
For example
'dataMyAttr' becomes 'data-my-attr',
'dataAB' becomes 'data-a-b'. -
CONTROL_CHARACTERRegExp
-
Regex matches C0 and C1 control codes, which seems to be good enough.
"The C0 set defines codes in the range 00HEX–1FHEX and the C1
set defines codes in the range 80HEX–9FHEX."
In addition, we include \x007f which is "delete", which just
seems like a good idea.
http://en.wikipedia.org/wiki/List_of_Unicode_characters
http://en.wikipedia.org/wiki/C0_and_C1_control_codes -
dashesToCamelCase
-
Converts a dashes form into camel cased form.
The given string should be all lowercase and should not begin with a
dash.
For example 'data-my-attr' becomes 'dataMyAttr'. -
NON_BREAKING_SPACERegExp
-
Regular expression that matches a non breaking space character.
-
NON_BREAKING_SPACE_CHARACTERSArray.<string>
-
Unicode non-breaking space characters as defined in the W3 HTML5
specification:
http://www.w3.org/TR/html5/infrastructure.html#common-parser-idioms -
NOT_SPACERegExp
-
Matches non-space characters. Complement to Strings.SPACE.
-
SPACERegExp
-
Matches space characters.
This includes all white space characters (matched with "\s"), and
the zero-width character ("\u200B"). -
TERMINAL_WHITE_SPACESRegExp
-
Matches white spaces at the beginning or ending of a string.
-
WHITE_SPACERegExp
-
Regular expression that matches a white space character.
-
WHITE_SPACE_CHARACTERSArray.<string>
-
Unicode White_Space characters are those that have the Unicode property
"White_Space" in the Unicode PropList.txt data file.
http://www.unicode.org/Public/UNIDATA/PropList.txt -
WHITE_SPACESRegExp
-
Regular expression that matches one or more white space characters.
-
WORD_BOUNDARYRegExp
-
Matches a word boundary.
-
WORD_BOUNDARY_FROM_ENDRegExp
-
Matches one or more sequence of characters denoting a word boundary from
the end of a string. -
WORD_BREAKING_CHARACTER
-
This RegExp is missing documentation.
- TODO
-
- Complete documentation.
-
WORD_BREAKING_CHARACTERSArray.<string>
-
Characters that delimit boundaries of words.
These include whitespaces, hyphens, and punctuation. -
ZERO_WIDTH_CHARACTERSArray.<string>
-
Unicode zero width space characters:
http://www.unicode.org/Public/UNIDATA/Scripts.txt -
ZERO_WIDTH_SPACERegExp
-
Regular expression that matches a zero width character.
Methods
-
addToList(list, entry){string}
-
Adds one or more entries to a space-delimited list.
Will return a new space delimited list with the new
entries added to the end.
The function is designed to deal with shoddy
whitespace separations such as multiple spaces or
even newlines, that may be used on a DOM Element's
class attribute.Name Type Description list
string entry
string repeatable -
isControlCharacter(chr){boolean}
-
Returns true if the given character is a control character. Control
characters are usually not rendered if they are inserted into the DOM.
Returns false for whitespace 0x20 (which may or may not be rendered see
Html.isUnrenderedWhitespace()) and non-breaking whitespace 0xa0 but
returns true for tab 0x09 and linebreak 0x0a and 0x0d.Name Type Description chr
string -
isEmpty(str){boolean}
-
Returns true for the empty string, null and undefined.
Name Type Description str
string optional -
removeFromList(list, entry){string}
-
Removes one or more entries from a space-delimited list.
Will return a new space delimited list with the specified
entries removed.
The function is designed to deal with shoddy
whitespace separations such as multiple spaces or
even newlines, that may be used on a DOM Element's
class attribute.Name Type Description list
string entry
string repeatable -
splitIncl(pattern){Array.<string>}
-
Split `str` along `pattern`, including matches in the result.
splitIncl("foo-bar", /\-/g) results in ["foo", "-", "bar"]
whereas
"foo-bar".split(/\-/g) results in ["foo", "bar"]
The given regular expression must include the g flag, otherwise will
result in an endless loop.
The resulting list of substrings will be in the order they appeared in
`str`.Name Type Description pattern
RegExp -
uniqueList(list){string}
-
Produces a space-delimited list with unique entries from
the provided list. Example:
'one two three two four two four five' => 'one two three four five'Name Type Description list
string -
words(str){Array.<string>}
-
Splits a string into a list of individual words.
Words are non-empty sequences of non-space characaters.Name Type Description str
string