C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
C# String EndsWith()The C# EndsWith() method is used to check whether the specified string matches the end of this string or not. If the specified string is found at the end of this string, it returns true otherwise false. Signaturepublic bool EndsWith(String str) public bool EndsWith(String, Boolean, CultureInfo) public bool EndsWith (String, StringComparison)? Parametersstr: it is a string object which is used to check the whether a specified string ends with it. ReturnIt returns boolean value either true or false. C# String EndsWith() Method Exampleusing System; public class StringExample { public static void Main(string[] args) { string s1 = "Hello"; string s2 = "llo"; string s3 = "C#"; Console.WriteLine(s1.EndsWith(s2)); Console.WriteLine(s1.EndsWith(s3)); } } Output: True False
Next TopicC# String Equals()
|