Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
between_markers solution in Uncategorized category for Between Markers (simplified) by Jon_Red
import assert from'assert';
function betweenMarkers(line:string,left:string,right:string):string{
return line.slice(line.indexOf(left)+1,line.indexOf(right));
}
// self-checks
assert.equal(betweenMarkers('What is >apple<','>','<'),'apple');
assert.equal(betweenMarkers('What is [apple]','[',']'),'apple');
assert.equal(betweenMarkers('What is ><','>','<'),'');
assert.equal(betweenMarkers('[an apple]','[',']'),'an apple');
July 11, 2020