Imagine that I have two strings, one of them is a url like \"/sdcard/test.avi\" and the other one is\"/sdcard/test.mkv\". I want to write an if statement that looks whether
In pure C you can only resort to manual compare:
int endswith(const char* withwhat, const char* what) { int l1 = strlen(withwhat); int l2 = strlen(what); if (l1 > l2) return 0; return strcmp(withwhat, what + (l2 - l1)) == 0; }