How to use 'javascript get string before character' in JavaScript

Every line of 'javascript get string before character' 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
31function charsAround(cm, pos) {
32 var str = cm.getRange(Pos(pos.line, pos.ch - 1),
33 Pos(pos.line, pos.ch + 1));
34 return str.length == 2 ? str : null;
35}

Related snippets