How do you use the Contains Function in Visual Basic?

C++ string content function help!?

  • trying to get the program to recognize different things in one string. and i want it to be in a function in a different class to be called to. Here is the code: #include <iostream> #include <fstream> #include <string> #include <sstream> #include <cstdlib> using namespace std; string input; bool strContains(const string inputStr, const string searchStr) { size_t contains; contains = inputStr.find(searchStr); if(contains != string::npos) return true; else return false; } class functions { public: static void test() { if(strContains(input, "go")) { printf ("True"); } else if(strContains(input, "Stay")) { printf ("False"); } } }; //Testing the string content use for calling other functions // and finding commands #include <iostream> #include <string> #include "function.cpp" using namespace std; int main() { functions p; string doing; string input; cout << "What shall we do sir?" << endl; cin >> doing; input = doing; if(strContains(input, ";")) { p.test(); } else cout << "False"; return 0; } I'm getting errors with the class function code. any ideas?

  • Answer:

    What errors are you getting? Because when i compiled your code (click here to see: http://codepad.org/QzwYYBX9 ) i didnt get any errors

daviddiz... at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.