Answers for "javascript string search second occurrence"

0

javascript string search second occurrence

const string = "XYZ 123 ABC 456 ABC 789 ABC";

function getPosition(string, subString, index) {
  return string.split(subString, index).join(subString).length;
}

console.log(
  getPosition(string, 'ABC', 2) // --> 16
)
Posted by: Guest on August-11-2021

Code answers related to "javascript string search second occurrence"

Code answers related to "Javascript"

Browse Popular Code Answers by Language