“Verifique se a substring no string the TypeScript” Respostas de código

Verifique se a substring no string the TypeScript

const string = "foo";
const substring = "oo";

console.log(string.includes(substring));
2 Programmers 1 Bug

JavaScript contém substring

var str = "We got a poop cleanup on isle 4.";
if(str.indexOf("poop") !== -1){
	alert("Not again");
}
//use indexOf (it returns position of substring or -1 if not found)
Grepper

Verifique se a substring no string the TypeScript

var string = "foo";
var substring = "oo";

console.log(string.indexOf(substring) !== -1);
2 Programmers 1 Bug

Respostas semelhantes a “Verifique se a substring no string the TypeScript”

Perguntas semelhantes a “Verifique se a substring no string the TypeScript”

Mais respostas relacionadas para “Verifique se a substring no string the TypeScript” em JavaScript

Procure respostas de código populares por idioma

Procurar outros idiomas de código