contains

Summary

Checks if the string contains the specified substring.

Usage

public bool contains(string substr)

Returns

true if the substring is contained in the string and false if the substring is not found in the string.

Parameters

substr

The substring to search for.

Description

Checks if the string contains the specified substring.

The search performed is case-sensitive.

Examples

Basic Usage
1
2
3
4
5
6
7
import System;
 
string letters = "abcdef";
Console.log(letters.contains("a"));   // true
Console.log(letters.contains("abc")); // true
Console.log(letters.contains("def")); // true
Console.log(letters.contains("zzz")); // false

Share

HTML | BBCode | Direct Link