Is there a benefit to using printf() instead of not?

PrintLine(FString::Printf(TEXT(“Hello! %s”), *HiddenWord));

vs

PrintLine(TEXT(“Hello! %s”), *HiddenWord);

What benefit does the FString::Printf() have?

It was to showcase that it exists. FString::Printf creates an FString using printf formatting (function from C).

PrintLine(FString::Printf(TEXT(“Hello! %s”), *HiddenWord));

Calls a different overload for PrintLine which in turn just calls the other PrintLine with FString::Printf

No there is no benfit in terms of performance or runtime. You would use FString::Printf() only if it isn’t declared in definition of PrintLine().
FString:: basically means “Hi FString class I want to access and use your methods”

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

Privacy & Terms