5 examples of 'last occurrence of a character in a string javascript' in JavaScript

Every line of 'last occurrence of a character in a string javascript' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
59get prevChar(): number {
60 return this.position - 1 >= 0 ? this._text.charCodeAt(this.position - 1) : 0;
61}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

395function previous(): string {
396 return source.charAt(currentIndex - 2)
397}
67lookAhead(offset: number): number {
68 const pos = this._position + offset;
69 return pos < 0 || pos >= this._text.length ? 0 : this._text.charCodeAt(pos);
70}
200function char_(str, i) {
201 return str.charCodeAt(i);
202}
140function replaceLastCharacter(string, character) {
141 return string.slice(0, string.length - 1) + character;
142}

Related snippets