Skip to content

Latest commit

 

History

History
25 lines (21 loc) · 888 Bytes

contains.md

File metadata and controls

25 lines (21 loc) · 888 Bytes
title tags author_title author_url author_image_url description image
contains
function
intermediate
Deepak Vishwakarma
Implementation of "contains" in typescript, javascript and deno.

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