1
0
Fork 0

contains()

This commit is contained in:
Jan Steemann 2012-05-31 13:15:00 +02:00
parent 86874a8def
commit 2b841bacf7
2 changed files with 26 additions and 0 deletions

View File

@ -1293,6 +1293,19 @@ function AHUACATL_STRING_SUBSTRING (value, offset, count) {
return value.substr(offset, count);
}
////////////////////////////////////////////////////////////////////////////////
/// @brief searches a substring in a string
///
/// the two input operands must be strings or this function will fail
////////////////////////////////////////////////////////////////////////////////
function AHUACATL_STRING_CONTAINS (value, search) {
AHUACATL_ARG_CHECK(value, AHUACATL_TYPEWEIGHT_STRING, "CONTAINS");
AHUACATL_ARG_CHECK(offset, AHUACATL_TYPEWEIGHT_STRING, "CONTAINS");
return value.indexOf(search) != -1;
}
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////

View File

@ -1295,6 +1295,19 @@ static string JS_server_ahuacatl =
"}\n"
"\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"/// @brief searches a substring in a string\n"
"///\n"
"/// the two input operands must be strings or this function will fail\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"
"function AHUACATL_STRING_CONTAINS (value, search) {\n"
" AHUACATL_ARG_CHECK(value, AHUACATL_TYPEWEIGHT_STRING, \"CONTAINS\");\n"
" AHUACATL_ARG_CHECK(offset, AHUACATL_TYPEWEIGHT_STRING, \"CONTAINS\");\n"
"\n"
" return value.indexOf(search) != -1;\n"
"}\n"
"\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"/// @}\n"
"////////////////////////////////////////////////////////////////////////////////\n"
"\n"