Quote:Original post by darenking
OK, I can do it like this:
if ( line.find("hello") == 0 )
This checks to see if the string contains "hello" starting at the start of the string (position 0).
Works just fine, though I do wonder if there's a string method that checks to see if the string is exactly equal to 'hello'. The above would return 0 if the string is 'hello' but it will also return 0 if the string is 'hellogoodbye'.
if you want to check the first 2 chars in phrase then write this
string.substr(0,2) == "//"