expose ToInt and ToFloat from FString as ToInt and ToDouble

This commit is contained in:
Alexander Kromm 2025-09-03 19:17:51 +07:00 committed by Rachael Alexanderson
commit 655d01ba4d
2 changed files with 25 additions and 0 deletions

View file

@ -526,6 +526,27 @@ DEFINE_ACTION_FUNCTION_NATIVE(FStringStruct, CharLower, StringCharLower)
ACTION_RETURN_INT(StringCharLower(ch));
}
static int StringIsInt(FString *self)
{
return self->IsInt();
}
DEFINE_ACTION_FUNCTION_NATIVE(FStringStruct, IsInt, StringIsInt)
{
PARAM_SELF_STRUCT_PROLOGUE(FString);
ACTION_RETURN_INT(self->IsInt());
}
static int StringIsDouble(FString *self)
{
return self->IsFloat();
}
DEFINE_ACTION_FUNCTION_NATIVE(FStringStruct, IsDouble, StringIsDouble)
{
PARAM_SELF_STRUCT_PROLOGUE(FString);
ACTION_RETURN_INT(self->IsFloat());
}
static int StringToInt(FString *self, int base)
{

View file

@ -975,8 +975,12 @@ struct StringStruct native unsafe(internal)
native String MakeLower() const;
native static int CharUpper(int ch);
native static int CharLower(int ch);
native bool IsInt() const;
native bool IsDouble() const;
native int ToInt(int base = 0) const;
native double ToDouble() const;
native void Split(out Array<String> tokens, String delimiter, EmptyTokenType keepEmpty = TOK_KEEPEMPTY) const;
native void AppendCharacter(int c);
native void DeleteLastCharacter();