CPP/Strings/Find
From ProgrammingExamples
< CPP
Find.cpp
#include <iostream> #include <string> #include <algorithm> int main(int argc, char *argv[]) { std::string hello = "hello"; int pos = hello.find("he"); // should return 0 std::cout << "pos of 'he' " << pos << std::endl; pos = hello.find("lo"); // should return 3 std::cout << "pos of 'lo' " << pos << std::endl; pos = hello.find("test"); // should return -1 std::cout << "pos of 'test' " << pos << std::endl; return 0; }
CMakeLists.txt
cmake_minimum_required(VERSION 2.6) PROJECT(Find) ADD_EXECUTABLE(Find Find.cpp )