Check if a string is a substring of another string - Node.js String

Node.js examples for String:sub string

Description

Check if a string is a substring of another string

Demo Code

function notIn( str1, str2 )
{
    var i = 0;//from w w  w .j ava2s  . c  o m
    var j = str2.length;
    for( ; i<j; i++ )
    {
        var str3 =  str2.charAt(i);
        if( str1.indexOf( str3 ) != -1 )
            return false;
    }
    return true;
}

Related Tutorials