Added IndexOf() and LastIndexOf() functions to ZScript string type

https://forum.zdoom.org/viewtopic.php?t=57313
This commit is contained in:
alexey.lysiuk 2017-07-22 10:54:32 +03:00
commit c56cd245ac
2 changed files with 17 additions and 0 deletions

View file

@ -1252,3 +1252,18 @@ DEFINE_ACTION_FUNCTION(FStringStruct, Filter)
ACTION_RETURN_STRING(strbin1(*self));
}
DEFINE_ACTION_FUNCTION(FStringStruct, IndexOf)
{
PARAM_SELF_STRUCT_PROLOGUE(FString);
PARAM_STRING(substr);
PARAM_INT_DEF(startIndex);
ACTION_RETURN_INT(self->IndexOf(substr, startIndex));
}
DEFINE_ACTION_FUNCTION(FStringStruct, LastIndexOf)
{
PARAM_SELF_STRUCT_PROLOGUE(FString);
PARAM_STRING(substr);
ACTION_RETURN_INT(self->LastIndexOf(substr));
}