Last active
February 15, 2016 10:27
-
-
Save ayushgp/fd0b23a6d214e451edf1 to your computer and use it in GitHub Desktop.
Xapian 'contains' method for OmegaScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Added this at line 886: | |
CMD_contains, | |
//Added the function description at line 1012 | |
T(contains, 2, 2, N, 0), //return position of substring, if not found return empty string | |
//Implemented contains function at line | |
case CMD_contains: { | |
size_t pos = args[1].find(args[0]); | |
if(pos!=string::npos){ | |
stringstream ss; | |
ss << pos; | |
value = ss.str(); | |
} else { | |
value = ""; | |
} | |
break; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment