-
charAt(pos: number): stringES1Returns the character at index
pos, as a string (JavaScript does not have a datatype for characters).str[i]is equivalent tostr.charAt(i)and more concise.> 'abc'.charAt(1) 'b' -
charCodeAt(pos: number): numberES1Returns the 16-bit number (0–65535) of the UTF-16 code unit (character) at index
pos.> 'abc'.charCodeAt(1) 98 -
codePointAt(pos: number): number | undefinedES6Returns the number of the Unicode code point of the 1–2 characters at index
pos. If there is no such index, it returnsundefined. -
concat(...strings: string[]): stringES3Returns the concatenation of
thisandstrings.'a'+'b'is equivalent to'a'.concat('b')and more concise.> 'ab'.concat('cd', 'ef', 'gh') 'abcdefgh' -
endsWith(searchString: string, endPos=this.length): booleanES6Returns
trueifthisends withsearchStringat indexendPosandfalse, otherwise.> 'foo.txt'.endsWith('.txt') true > 'abc'.endsWith('ab', 2) true -
includes(searchString: string, startPos=0): booleanES6Returns
trueifthiscontains thesearchStringandfalse, otherwise. The search starts atstartPos.> 'abc'.includes('b') true > 'abc'.includes('b', 2) false -
indexOf(searchString: string, minIndex=0): numberES1Returns the lowest index at which
searchStringappears withinthis, or-1, otherwise. Any returned index will beminIndexor higher.> 'abab'.indexOf('a') 0 > 'abab'.indexOf('a', 1) 2 > 'abab'.indexOf('c') -1 -
lastIndexOf(searchString: string, maxIndex=Infinity): numberES1Returns the highest index at which
searchStringappears withinthis, or-1, otherwise. Any returned index will bemaxIndexor lower.> 'abab'.lastIndexOf('ab', 2) 2 > 'abab'.lastIndexOf('ab', 1) 0 > 'abab'.lastIndexOf('ab') 2
- String.prototype.localeCompare ( that [ , reserved1 [ , reserved2 ] ] )
- String.prototype.match ( regexp )
- String.prototype.normalize ( [ form ] )
- String.prototype.padEnd( maxLength [ , fillString ] )
- String.prototype.padStart( maxLength [ , fillString ] )
- String.prototype.repeat ( count )
- String.prototype.replace ( searchValue, replaceValue )
- String.prototype.search ( regexp )
- String.prototype.slice ( start, end )
- String.prototype.split ( separator, limit )
- String.prototype.startsWith ( searchString [ , position ] )
- String.prototype.substring ( start, end )
- String.prototype.toLocaleLowerCase ( [ reserved1 [ , reserved2 ] ] )
- String.prototype.toLocaleUpperCase ( [ reserved1 [ , reserved2 ] ] )
- String.prototype.toLowerCase ( )
- String.prototype.toString ( )
- String.prototype.toUpperCase ( )
- String.prototype.trim ( )
- String.prototype.valueOf ( )
- String.prototype [ @@iterator ] ( )
- String methods of various ECMAScript versions in detail: http://exploringjs.com
- https://github.com/Microsoft/TypeScript/blob/master/lib/lib.es6.d.ts
- MDN
- ECMAScript spec
So to replace all '.'
we need to skip the special character like this.