TEXT Macro inside the function FString Input

hi
TEXT macro is cool…i used all the FString with TEXT() macro but how about Input value inside function;

void UBullCowCartridge::OnInput(const FString& Input)

do we have to convert the Input to Text although it is const& so we might change the type here but if we assign Input to a variable inside the function …

will this be acceptable ;
void UBullCowCartridge::OnInput(const FString& TEXT(Input))
{
}

TEXT() is only for string literals as all it does is ensure that the literal is of the correct type for the platform you’re compiling for.

"hello"
L"hello"

The first is of type const char[6] while the other is of type const wchar_t[6].

Unreal uses Unicode as their native encoding.
Windows supports Unicode using wchar_t as the data type to store Unicode code points.

This is what the TEXT macro does on Windows, prepends an L.

1 Like

thanks for the reply and type info…
i also looked at the macro and type definition FString thru the code so we better use TEXT(Input) inside function argument …I tried it , it works …just asking in terms of if it is to good practice to use inside the function argument…thanks …awesome course…

Input is not a string literal. If you’re on Windows that would just mean Input is actually called LInput. Because as I said, it will just prepend L on Windows.

1 Like

ok thnks then there is no need for the Input…awesome and clear

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms