endsWith Summary Checks if the string ends with the specified substring. Usage public bool endsWith(string substr) Returns true if the string ends with the specified substring and false otherwise. Parameters substr The substring to check for at the end of the string. Description Checks if the string ends with the specified substring. This method is case-sensitive. Examples Basic Usage 12345import System; string str = "This is a test";Console.log(str.endsWith("test")); // trueConsole.log(str.endsWith("fog")); // false Case-insensitive endsWith 1234567import System; string sentence = "This is a test";string substr = "Test";Console.log( sentence.toLowerCase().endsWith(substr.toLowerCase())); Share HTML | BBCode | Direct Link