Navigate back to the homepage

How to check a substring in a string in typescript?

November 8th, 2021 · 1 min read

Hello Friends 👋,

Welcome To Infinitbility! ❤️

To check if a string contains a substring in typescript, just use the .includes() method it will check and return the result as a boolean based on whether the substring is available on a string or not.

This tutorial will help you to check substring is present or not in a string using typescript syntax examples. here we are using the .includes() method to check substring available in string.

Let start today tutorial How to check a substring in a string in typescript?

The .includes() method return true and false based on string avalablity.

Let create the first example string and substring variable with data.

1let str: string = "We have the ability to build infinite way for us --infinitbility";
2let subStr: string = "build";

For check substring in a string let use the .includes() method.

1str.includes(subStr); // true


includes, typescript, Example

Follow me on Twitter

Join our email list and get notified about new content

No worries, I respect your privacy and I will never abuse your email.

Every week, on Tuesday, you will receive a list of free tutorials I made during the week (I write one every day) and news on other training products I create.

Looking For React Native Tutorial?

we are trying to create the best Tutorial for react native developers.

When you want a daily updates about React Native Tutorial or infinitbility update subscribe to our newsletter.

Read React Native Tutorial

Request New Tutorial or Article on mail [email protected]

Guide book

Guidebook: The Javascript Monorepo Photoshop Guide



More articles from Infinitbility

How to check array is empty in typescript?

Example of check array is empty or not in typescript

November 7th, 2021 · 1 min read

How to check array contains value in typescript?

Example of check array contains value or not in typescript

November 6th, 2021 · 1 min read
© 2020–2022 Infinitbility
Link to $ to $ to $ to $ to $ to $mailto:[email protected]