Jump to content

Recommended Posts

Posted

function _stringBetween(sSource, sFrom, sTo) {
    sOutput = sSource
    
    iFrom = sOutput.indexOf(sFrom)
    if (iFrom == -1) return false
    sOutput = sOutput.substring(iFrom + sFrom.length, sOutput.length)
    
    iTo = sOutput.indexOf(sTo)
    if (iTo == -1) return false
    sOutput = sOutput.substring(0, iTo)
    
    return sOutput
}

sTest = 'Hello my name is Simon, I like to do drawings.'
alert(_stringBetween(sTest, 'my', 'to'))

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...