count Summary Counts the occurrences of the specified substring in the string. Usage public unsigned int count(string substr) Returns The number of occurrences of the specified substring in the string. Parameters substr The substring to count. Description Counts the number of occurrences of the specified substring in the string. The counting operation is case-sensitive. Examples Basic Usage 123456import System; string str = "abc 123 abc 123";Console.log(str.count("abc")); // 2Console.log(str.count("123")); // 2Console.log(str.count("456")); // 0 Share HTML | BBCode | Direct Link