mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 22:11:43 +00:00
Added IndexOf() and LastIndexOf() functions to ZScript string type
https://forum.zdoom.org/viewtopic.php?t=57313
This commit is contained in:
parent
ebd20daed8
commit
c56cd245ac
2 changed files with 17 additions and 0 deletions
|
@ -1252,3 +1252,18 @@ DEFINE_ACTION_FUNCTION(FStringStruct, Filter)
|
||||||
ACTION_RETURN_STRING(strbin1(*self));
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -656,6 +656,8 @@ struct StringStruct native
|
||||||
native String CharAt(int pos) const;
|
native String CharAt(int pos) const;
|
||||||
native int CharCodeAt(int pos) const;
|
native int CharCodeAt(int pos) const;
|
||||||
native String Filter();
|
native String Filter();
|
||||||
|
native int IndexOf(String substr, int startIndex = 0) const;
|
||||||
|
native int LastIndexOf(String substr) const;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SectorEffect : Thinker native
|
class SectorEffect : Thinker native
|
||||||
|
|
Loading…
Reference in a new issue