String contains another string [duplicate] November 22, 2022 by Tarik You can use .indexOf(): if(str.indexOf(substr) > -1) { }