Check if a string is suffix of another | C # program to find if a string is suffix of another ; Driver code ; Test case - sensitive implementation of endsWith function
using System ; class GFG { static bool isSuffix ( string s1 , string s2 ) { int n1 = s1 . Length , n2 = s2 . Length ; if ( n1 > n2 ) return false ; for ( int i = 0 ; i < n1 ; i ++ ) if ( s1 [ n1 - i - 1 ] != s2 [ n2 - i - 1 ] ) return false ; return true ; } public static void Main ( ) { string s1 = " geeks " , s2 = " geeksforgeeks " ; bool result = isSuffix ( s1 , s2 ) ; if ( result ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }