FText::GetFormatPatternParameters
#include "Internationalization/Text.h"
Access: public
Specifiers: static
Description
Extracts the list of named argument placeholders (e.g. {PlayerName}, {Count}) from a compiled FTextFormat, useful for validating or introspecting format strings at runtime.
Caveats & Gotchas
- • The function appends to ParameterNames rather than clearing it first; if you reuse the array across multiple calls, clear it beforehand to avoid accumulating stale names.
- • Parameter names are returned in the order they appear in the pattern and may contain duplicates if a placeholder is used more than once — deduplicate if you need a unique set.
Signature
static CORE_API void GetFormatPatternParameters(const FTextFormat& Fmt, TArray<FString>& ParameterNames) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Fmt | const FTextFormat& | The compiled format pattern to inspect. | — |
| ParameterNames | TArray<FString>& | Output array that receives the names of all format arguments referenced in the pattern. | — |
Return Type
void Example
Validate that all required arguments are supplied C++
FTextFormat Format = FTextFormat::FromString(LOCTEXT("Greeting", "Hello, {PlayerName}! You have {Count} messages."));
TArray<FString> Params;
FText::GetFormatPatternParameters(Format, Params);
// Params now contains ["PlayerName", "Count"]
for (const FString& Param : Params)
{
UE_LOG(LogTemp, Log, TEXT("Required param: %s"), *Param);
} See Also
Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?