Skip to content

Instantly share code, notes, and snippets.

@neilmayhew
Created December 4, 2020 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neilmayhew/28c88f8babaaf2e6e97e02f6e288d269 to your computer and use it in GitHub Desktop.
Save neilmayhew/28c88f8babaaf2e6e97e02f6e288d269 to your computer and use it in GitHub Desktop.
A test harness for the isPrefix function
#include <iostream>
#include <string>
inline int isPrefix(std::string pre, std::string str)
{
return str.compare(0, pre.size(), pre);
}
int main(int argc, char const *argv[])
{
std::cout << isPrefix(argv[1], argv[2]) << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment