User:PerfektesChaos/js/stringLib/doc

.charEnt5single
HTML 5 single character entities

.locateEntities
User option: Expect any HTML entity

or

.sortLang
User option: Language used for sorting

string or

.sortMode
User option: Special sorting mode

string like 'de-DIN31638' or

.spaces
Various types of spaces

string with all spaces except ASCII

.sticks
Various types of horizontal dashes and lines

string with all dashes including ASCII hyphen-minus in front

.camelCasing
Upcase first character, keep inner camelCasing
 * Parameters
 * – string to be camelCased


 * Returns
 * camelCased string

.capitalize
Upcase first character, downcase anything else
 * Parameters
 * – string to be capitalized


 * Returns
 * capitalized string

.charEntity
Retrieve character code (UCS) for named HTML4 or numeric entity
 * Parameters
 * – string to be examined

if not resolved UCS code of single character
 * Returns
 * information about character


 * Since
 * JavaScript 1.3 String.charCodeAt

.charEntityAt
Retrieve character code of ML entity at position
 * Parameters
 * – string to be examined
 * – position in adjust
 * – true: '&' at address; false: ';' at address

code value entity position length of entity
 * Returns
 * Array with entity information, or


 * Since
 * JavaScript 1.3 String.charCodeAt

.charEntityCode
Retrieve character code (UCS) for numeric ML entity first two characters are assumed to be '&#' third character may be 'x' or digit last character is assumed to be ';'
 * Parameters
 * – string with character entity like "&#xHH;" or "&#NN;"

if not resolved UCS code of single character
 * Returns
 * information about character


 * Since
 * JavaScript 1.3 String.charCodeAt

.charEntityHTML4
Retrieve character code (UCS) for named HTML4 (or similar) entity first character is assumed to be '&' last character is assumed to be ';'
 * deprecated – replaced by
 * Parameters
 * – string with character named entity "&xyz;"

if not resolved UCS code of single character
 * Returns
 * information about character

.charEntityHTML5single
Retrieve single character code (UCS) for named HTML5 entity first character is assumed to be '&' last character is assumed to be ';'
 * Parameters
 * – string with character named entity "&xyz;"

if not resolved UCS code of single character
 * Returns
 * information about character

.deCapitalize
Downcase first character; keep inner camelCasing
 * Parameters
 * – string to be decapitalized


 * Returns
 * decapitalized string

.decodeOctet
Retrieve hexadecimal value of octet similar to parseInt base 16 but consider uppercase A-F only
 * Parameters
 * – string to be analyzed
 * – index in string


 * Returns
 * parsed number 0...15, or -1 if invalid


 * Since
 * JavaScript 1.3 String.charCodeAt

.decodeXML
Convert string with XML entities as unescaped string
 * Parameters
 * – string to be analyzed


 * Returns
 * string, may be unchanged


 * Since
 * JavaScript 1.3 String.charCodeAt String.fromCharCode

.escapeLight
Minimal escaping for HTML
 * Parameters
 * – string to be escaped


 * Returns
 * string with escaping

.fromCharCode
Extended fromCharCode for UCS > 0xFFFF (4 bytes/char)
 * Parameters
 * – number, UCS


 * Returns
 * single character, which might have a string length of 2 instead of 1


 * Since
 * JavaScript 1.3 String.fromCharCode 2 byte chars only

.fromNum
Format number as string
 * Parameters
 * – number to be formatted


 * Returns
 * adjust as string

.hexcode
Retrieve hexadecimal representation
 * Parameters
 * – number: decimal
 * – left padded number of digits, or false
 * – true: use lowercase letters


 * Returns
 * string with hex number

.isASCII
Test for ASCII only characters
 * Parameters
 * – string to be examined


 * Returns
 * iff ask consists of ASCII characters only

.isBlank
Test for invisible character
 * Parameters
 * – character code to be examined
 * – : include zero width and marks


 * Returns
 * iff ask is any space or other invisible character code

.isLetter
Test whether a character is a letter (latin based, greek, cyrillic)
 * Parameters
 * – character code to be examined, or string (first char)


 * Returns
 * iff ask is identified as any kind of letter


 * Since
 * JavaScript 1.3 String.charCodeAt

.isWhiteBlank
Test for invisible character or newline
 * Parameters
 * – character code to be examined
 * – : include zero width and direction marks
 * – : behave like .isBlank


 * Returns
 * iff ask is any whitespace or other invisible


 * See
 * .isBlank

.makeString
Return string of certain length with repeated character
 * Parameters
 * – character code to be set
 * – number of repeated characters apply


 * Returns
 * new string

.parseIntNumber
Parse integer number string, but do not return NaN
 * Parameters
 * – string to be manipulated, or undefined
 * – number base: 10 or 16; if false detect leading 'x'


 * Returns
 * number, 0 if not caught


 * Since
 * JavaScript 1.3 String.charCodeAt

.setChar
Set character or string at certain string position
 * Parameters
 * – string to be manipulated
 * – character code or string to be set
 * – single character position to be replaced


 * Returns
 * modified string


 * Since
 * JavaScript 1.3 String.fromCharCode One day direct array[i] setting might work in a JavaScript String.

.setString
Modify string in certain range
 * Parameters
 * – string to be manipulated
 * – character position to start replacement
 * – range specification number of characters to be removed at address string (adjust.length is used as number)
 * – string to replace range


 * Returns
 * modified string


 * Since
 * JavaScript 1.3 String.fromCharCode

.sortAppropriate
Retrieve sortable character(s) in particular local environment (hook) (RegExp is not modified) 196 * Ä 197 * Å 198 * Æ *always* 228 * ä 229 * å 230 * æ *always* 208 * Ð 272 * Dstroke 240 * ð 273 * dstroke 568 * db digraph *always* 452 * D with Z caron *always* 497 * D with Z *always* 453 * D with z caron *always* 498 * D with z *always* 454 * d with z caron *always* 499 * d with z *always* 455 * L with J *always* 456 * L with j *always* 457 * l with j *always* 458 * N with J *always* 459 * N with j *always* 460 * n with j *always* 214 * Ö 246 * ö 338 * OElig *always* 339 * oelig *always* 546 * OU *always* 547 * ou *always* 569 * qp digraph *always* 223 * ß *always* 7838 * capital sharp S *always* 222 * Þ *always* 254 * þ *always* 220 * Ü 252 * ü
 * Parameters
 * – character code of a single character

no particular local request remove character from sort key with ASCII code of single character of two ASCII characters, (first) character case will be kept, second char (if any) downcase.
 * Returns
 * information about sortable character


 * See
 * .sortLang

.sortChar
Retrieve sortable character(s) for non-ASCII Latin based Unicode (RegExp is not modified) (expecting  from 160 up)
 * Parameters
 * – character code of a single character

if nothing to do remove character from sort key with ASCII code of single character of two ASCII characters, (first) character case will be kept, second char (if any) downcase. Only glyphs used in any (European) language considered.
 * Returns
 * information about sortable character

.sortLocale
Retrieve sortcode char or string for Unicode German DIN 31638 (DIN 5007) requests umlaut "Ae" when sorting names of persons,
 * Parameters
 * – string to be checked
 * – language code, or false

no particular local request Replace by two character string for German umlauts or scandinavian "aa" for Aring.
 * Returns
 * sortable string or character


 * See
 * .sortMode

.sortString
Retrieve sortable string for non-ASCII Latin based Unicode Trailing or multiple whitespace shrinks. Replace two character string for German umlauts and scandinavian Aring. German DIN 31638 (DIN 5007) requests umlaut "Ae" when sorting names of persons, and scandinavian languages use the same transscription as well as "aa" for aring.
 * Parameters
 * – string to be checked or modified
 * – optional

if nothing to do, adjust is fine changes against adjust Only glyphs used in any (European) language considered.
 * Returns
 * information about sortable string


 * Since
 * JavaScript 1.3 String.charCodeAt String.fromCharCode

.spaced
Turn spacing charcodes of any kind into ASCII spaces, and trim
 * Parameters
 * – string to be standardized
 * – true: remove also zero width and direction marks
 * – true: keep entities


 * Returns
 * modified string // .isWhiteBlank // .charEntityAt

.substrEnd
Retrieve last characters from string like Mozilla substr(-n, n)
 * Parameters
 * – string
 * – position counted from end
 * – optional: number of chars, if not amount


 * Returns
 * string at end


 * Since
 * JavaScript 1.0 String.substr

This function has been included for compatibility reasons. With ECMA.3, String.slice with negative start argument will work. String.slice with negative argument wasn’t defined in earlier JS. String.substr with negative argument does not go with IE.

.substrExcept
Retrieve all but last characters from string
 * Parameters
 * – string
 * – position counted from end


 * Returns
 * string until near end


 * See
 * .substrEnd

.terminated
Return substring terminated by separator, or entirely
 * Parameters
 * – string to be extracted
 * – string with separator to be excluded


 * Returns
 * modified string, excluding at

.trim
Remove heading or trailing spacing charcodes of any kind
 * Parameters
 * – string to be trimmed
 * – true: remove also zero width and direction marks
 * – true: remove also trailing line breaks
 * – true: keep entities


 * Returns
 * modified string

.trimL
Return string without heading spacing charcodes of any kind
 * Parameters
 * – string to be trimmed
 * – true: remove also zero width and direction marks
 * – true: remove also line breaks
 * – true: keep entities


 * Since
 * JavaScript 1.3 String.charCodeAt


 * See
 * .locateEntities

.trimR
Return string without trailing spaces charcodes of any kind
 * Parameters
 * – string to be trimmed
 * – true: remove also zero width and direction marks
 * – true: remove also line breaks
 * – true: re-establish line breaks after trimming
 * – true: keep entities


 * Since
 * JavaScript 1.3 String.charCodeAt


 * See
 * .locateEntities

.uniques
Return string with unique sequence of items
 * Parameters
 * – string to be reduced, items separated by against
 * – string with character for separation


 * Returns
 * string with all items in adjust, separated by  (no leading nor trailing  )