跳到主要内容

contains

TS JS Deno

Returns true if given string s1 contains s2. Compare is case insensitive.

const contains = (s1: string, s2: string = "") =>
s1.toLowerCase().indexOf(s2.toLowerCase()) !== -1;
contains("Text1", "Ext"); // true
contains("Text1", "et"); // false