Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Find the position of 'what you need'.
Find the length of 'what you need'.
Cut out 'what you want' with substr.
function rtrim( src, core) {
var pos = src.indexOf(core);
if( !!~pos) return src.substr(0, pos + core.length);
else return src;
}
rtrim( "текст текст текст 'то что нужно' текст текст", "то что нужно") // текст текст текст 'то что нужно
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question