fromCharChode
String.fromCharChode(num code1, ...)
=> {str} string created by sequence of char-codes
#safe
#staticcharCodeAt
.charCodeAt(num index)
=> {num} numeric Unicode value at `index` of string
#safeindex
- range: 0 - length-1, else NaN returned
indexOf
.indexOf(str search, num start=0)
=> {num} index of `search` match, else -1
#safestart
lastIndexOf
.lastIndexOf(str search, num start=length)
=> {num} index of `search` match, searched from right-to-left, else -1
#safestart
match
.match(reg search)
=> {array|null} array of `search` match results, or null if none were found
#safesearch
new RegExp(search).search has the g flag, the array will be matches only: [match1, match2, …]g flag is absent, the returned array will be: [match, captureParens, ..., index: match-index, input: provided-string]replace
.replace(str|reg search, str|func replace)
=> {str} string with `search` replaced by `replace`
#safe
search
replace - if string, can use characters \$\$ => $ $& => matched substring $` => text prior to match $' => text after match $n => capturing-parens of `search` regexp pattern - if function, will be called for every match and the returned value used as the search-replacement; arguments are identical to the pattern.exec() or str.match() array (when pattern omits g-flag): - match - matched substring - p1... - capturing parens 1, etc. (if applies) - index - index when match starts - input - input-string
search
.search(reg search)
=> {num} index of `search` match, else -1
#safeslice
.slice(num start, num end=length)
=> {str} sub-string of string from start to end index
#safestart
end
split
.split(str|reg separator, num limit=none)
=> {arr} array of substrings split by `separator`
#safeinput
- if initial string is empty, returns [’’]
separator
limit
- ONLY truncates the returned array afterwards
substr
.substr(num start, num length=length)
=> {str} substring between start & length
#safestart
length
- if length is
substring
.substring(num start, num end=length)
=> {str} substring between start & end index
#safe
#slow - better to use slice()start|end
- range 0 - length; if outside, converts into closest range member ( end, start & end become swapped
end
- exclusive
toLowerCase
.toLowerCase()
=> {str} string lowercased
#safetoUpperCase
.toUpperCase()
=> {str} string uppercased
#safetrim
.trim()
=> {str} string with whitespace removed from beginning and end
#ES5