TString myString = "hello world"; if (myString.EndsWith("world")) { cout << "String ends with 'world'" << endl; }
TString myString = "hello world!"; if (myString.EndsWith("!")) { cout << "String ends with '!'" << endl; }
TString myString = "hello world"; TString substring = "world"; if (myString.EndsWith(substring)) { cout << "String ends with '" << substring << "'" << endl; }In all these examples, we're using the ROOT package library's TString EndsWith function to determine if a TString ends with a certain substring.