FName

Public name, available to the world.

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/UObject/NameTypes.h

Include

#include "UObject/NameTypes.h"

Syntax

class FName

Remarks

Public name, available to the world. Names are stored as a combination of an index into a table of unique strings and an instance number. Names are case-insensitive, but case-preserving (when WITH_CASE_PRESERVING_NAME is 1)

Constructors

Name Description

Public function

FName()

Default constructor, initialized to None

Public function

FName

(
    const WIDECHAR* Name,
    EFindName FindType
)

Create an FName.

Public function

FName

(
    const ANSICHAR* Name,
    EFindName FindType
)

Public function

FName

(
    const UTF8CHAR* Name,
    EFindName FindType
)

Public function

FName

(
    TStringView< ANSICHAR > View,
    EFindName FindType
)

Public function

FName

(
    TStringView< WIDECHAR > View,
    EFindName FindType
)

Create an FName with a hardcoded string index.

Public function

FName

(
    TStringView< UTF8CHAR > View,
    EFindName FindType
)

Create an FName with a hardcoded string index.

Public function

FName

(
    const WIDECHAR* Name,
    int32 Number
)

Public function

FName

(
    const ANSICHAR* Name,
    int32 Number
)

Public function

FName

(
    const UTF8CHAR* Name,
    int32 Number
)

Public function

FName

(
    TStringView< ANSICHAR > View,
    int32 InNumber
)

Public function

FName

(
    EName Ename
)

Create an FName with a hardcoded string index.

Public function

FName

(
    TStringView< WIDECHAR > View,
    int32 InNumber
)

Create an FName with a hardcoded string index.

Public function

FName

(
    TStringView< UTF8CHAR > View,
    int32 InNumber
)

Create an FName with a hardcoded string index.

Public function

FName

(
    FNameEntryId InComparisonIndex,
    FNameEntryId InDisplayIndex,
    int32 InNumber
)

Create an FName from its component parts Only call this if you really know what you're doing

Public function

FName

(
    int32 Len,
    const WIDECHAR* Name,
    EFindName FindType
)

Create FName from non-null string with known length

Public function

FName

(
    int32 Len,
    const ANSICHAR* Name,
    EFindName FindType
)

Public function

FName

(
    int32 Len,
    const UTF8CHAR* Name,
    EFindName FindType
)

Public function

FName

(
    const WIDECHAR* Name,
    int32 Number,
    EFindName FindType
)

EFindName has been removed from constructors taking a Number argument to add clarity around UE_FNAME_OUTLINE_NUMBER.

Public function

FName

(
    const ANSICHAR* Name,
    int32 Number,
    EFindName FindType
)

EFindName has been removed from constructors taking a Number argument to add clarity around UE_FNAME_OUTLINE_NUMBER.

Public function

FName

(
    const UTF8CHAR* Name,
    int32 Number,
    EFindName FindType
)

EFindName has been removed from constructors taking a Number argument to add clarity around UE_FNAME_OUTLINE_NUMBER.

Public function

FName

(
    int32 Len,
    const WIDECHAR* Name,
    int32 Number
)

Public function

FName

(
    ENoInit
)

Scary no init constructor, used for something obscure in UObjectBase

Public function

FName

(
    int32 Len,
    const ANSICHAR* Name,
    int32 Number
)

Public function

FName

(
    int32 Len,
    const UTF8CHAR* Name,
    int32 Number
)

Public function

FName

(
    TStringView< ANSICHAR > View,
    int32 InNumber,
    EFindName FindType
)

EFindName has been removed from constructors taking a Number argument to add clarity around UE_FNAME_OUTLINE_NUMBER.

Public function

FName

(
    TStringView< WIDECHAR > View,
    int32 InNumber,
    EFindName FindType
)

EFindName has been removed from constructors taking a Number argument to add clarity around UE_FNAME_OUTLINE_NUMBER.

Public function

FName

(
    TStringView< UTF8CHAR > View,
    int32 InNumber,
    EFindName FindType
)

EFindName has been removed from constructors taking a Number argument to add clarity around UE_FNAME_OUTLINE_NUMBER.

Public function

FName

(
    const TCHAR* Name,
    int32 InNumber,
    bool bSplitName
)

Public function

FName

(
    int32 Len,
    const WIDECHAR* Name,
    int32 Number,
    EFindName FindType
)

EFindName has been removed from constructors taking a Number argument to add clarity around UE_FNAME_OUTLINE_NUMBER.

Public function

FName

(
    int32 Len,
    const ANSICHAR* Name,
    int32 Number,
    EFindName FindType
)

EFindName has been removed from constructors taking a Number argument to add clarity around UE_FNAME_OUTLINE_NUMBER.

Public function

FName

(
    int32 Len,
    const UTF8CHAR* Name,
    int32 Number,
    EFindName FindType
)

EFindName has been removed from constructors taking a Number argument to add clarity around UE_FNAME_OUTLINE_NUMBER.

Public function

FName

(
    const TCHAR* Name,
    int32 InNumber,
    EFindName FindType,
    bool bSplitName
)

EFindName has been removed from constructors taking a Number argument to add clarity around UE_FNAME_OUTLINE_NUMBER.

Public function

FName

(
    FMinimalName InName
)

Public function

FName

(
    FScriptName InName
)

Create an FName with a hardcoded string index.

Public function

FName

(
    FMemoryImageName InName
)

Create an FName with a hardcoded string index.

Public function

FName

(
    const FNameEntrySerialized& Loaded...
)

Constructor used by FLinkerLoad when loading its name table; Creates an FName with an instance number of 0 that does not attempt to split the FName into string and number portions.

Public function

FName

(
    EName Ename,
    int32 InNumber
)

Create an FName with a hardcoded string index and (instance).

Public function

FName

(
    FName Other,
    int32 InNumber
)

Create an FName from an existing string, but with a different instance.

Functions

Name Description

Public function Static

void

 

AddNameToDisplayStringExemption

(
    const FString& InExemption
)

Add/remove an exemption to the formatting applied by NameToDisplayString.

Public function Const

void

 

AppendString

(
    FWideStringBuilderBase& Out
)

Converts an FName to a readable format, in place, appending to an existing string (ala GetFullName)

Public function Const

void

 

AppendString

(
    FUtf8StringBuilderBase& Out
)

Converts an FName to a readable format, in place, appending to an existing string (ala GetFullName)

Public function Const

void

 

AppendString

(
    FString& Out
)

Converts an FName to a readable format, in place, appending to an existing string (ala GetFullName)

Public function Const

void

 

AppendStringInternal

(
    StringBuilderType& Out
)

Public function Static

void

 

AutoTest()

Run autotest on FNames.

Public function Const

int32

 

Compare

(
    const FName& Other
)

Compares name to passed in one. Sort is alphabetical ascending.

Public function Const

int32

 

CompareIndexes

(
    const FName& Other
)

Fast non-alphabetical order that is only stable during this process' lifetime.

Public function Static

FName

 

CreateFromDisplayId

(
    FNameEntryId DisplayId,
    int32 Number
)

Only call this if you really know what you're doing

Public function Static

TArray< cons...

 

DebugDump()

Public function Static

void

 

DisplayHash

(
    FOutputDevice& Ar
)

Public function Const

bool

 

FastLess

(
    const FName& Other
)

Fast non-alphabetical order that is only stable during this process' lifetime.

Public function Static

FNameEntryId

 

GetComparisonIdFromDisplayId

(
    FNameEntryId DisplayId
)

Public function Const

FNameEntryId

 

GetComparisonIndex()

Public function Const

const FNameE...

 

GetComparisonNameEntry()

Public function Const

FNameEntryId

 

GetDisplayIndex()

Public function Const

const FNameE...

 

GetDisplayNameEntry()

Public function Static

FNameEntry c...

 

GetEntry

(
    FNameEntryId Id
)

Public function Static

FNameEntry c...

 

GetEntry

(
    EName Ename
)

Public function Static

int32

 

GetNameEntryMemorySize()

Public function Static

int32

 

GetNameTableMemorySize()

Public function Static

int32

 

GetNumAnsiNames()

Public function Const

int32

 

GetNumber()

Public function Static

int32

 

GetNumWideNames()

Public function Const

void

 

GetPlainANSIString

(
    ANSICHAR(&) AnsiName
)

Copy ANSI name without number part. Must only be used for ANSI FNames. Doesn't allocate.

Public function Const

uint32

 

GetPlainNameString

(
    TCHAR(&) OutName
)

Convert name without number part into TCHAR buffer and returns string length. Doesn't allocate.

Public function Const

FString

 

GetPlainNameString()

Get name without number part as a dynamically allocated string

Public function Const

void

 

GetPlainWIDEString

(
    WIDECHAR(&) WideName
)

Copy wide name without number part. Must only be used for wide FNames. Doesn't allocate.

Public function Const

uint32

 

GetStringLength()

Get the number of characters, excluding null-terminator, that ToString() would yield

Public function Const

bool

 

IsEqual

(
    const FName& Other,
    const ENameCase CompareMethod,
    const bool bCompareNumber
)

Check to see if this FName matches the other FName, potentially also checking for any case variations

Public function Const

bool

 

IsNone()

True for FName(), FName(NAME_None) and FName

Public function Const

bool

 

IsValid()

Paranoid sanity check

Public function Const

bool

 

IsValidGroupName

(
    FText& OutReason,
    bool bIsGroupName
)

Takes an FName and checks to see that it follows the rules that Unreal requires for package or group names.

Public function Const

bool

 

IsValidIndexFast()

Paranoid sanity check, same as IsValid()

Public function Const

bool

 

IsValidObjectName

(
    FText& OutReason
)

Takes an FName and checks to see that it follows the rules that Unreal requires for object names.

Public function Static

bool

 

IsValidXName

(
    const FStringView& InName,
    const FString& InInvalidChars,
    FText* OutReason,
    const FText* InErrorCtx
)

Checks to see that a given name-like string follows the rules that Unreal requires.

Public function Const

bool

 

IsValidXName

(
    FText& OutReason,
    const FString& InInvalidChars
)

Takes an FName and checks to see that it follows the rules that Unreal requires.

Public function Static

bool

 

IsValidXName

(
    const FString& InName,
    const FString& InInvalidChars,
    FText* OutReason,
    const FText* InErrorCtx
)

Checks to see that a given name-like string follows the rules that Unreal requires.

Public function Static

bool

 

IsValidXName

(
    const TCHAR* InName,
    const FString& InInvalidChars,
    FText* OutReason,
    const FText* InErrorCtx
)

Checks to see that a given name-like string follows the rules that Unreal requires.

Public function Static

bool

 

IsValidXName

(
    const FName InName,
    const FString& InInvalidChars,
    FText* OutReason,
    const FText* InErrorCtx
)

Checks to see that a given name-like string follows the rules that Unreal requires.

Public function Const

bool

 

IsValidXName

(
    const FString& InInvalidChars,
    FText* OutReason,
    const FText* InErrorCtx
)

Checks to see that a FName follows the rules that Unreal requires.

Public function Const

bool

 

LexicalLess

(
    const FName& Other
)

Slow alphabetical order that is stable / deterministic over process runs.

Public function Static

FString

 

NameToDisplayString

(
    const FString& InDisplayName,
    const bool bIsBool
)

Takes a string and breaks it down into a human readable string.

Public function Static

void

 

RemoveNameToDisplayStringExemption

(
    const FString& InExemption
)

Public function Static

FString

 

SafeString

(
    FNameEntryId InDisplayIndex,
    int32 InstanceNumber
)

Public function Static

FString

 

SanitizeWhitespace

(
    const FString& FNameString
)

Printing FNames in logging or on screen can be problematic when they contain Whitespace characters such as

Public function

void

 

SetNumber

(
    const int32 NewNumber
)

Public function Static

void

 

TearDown()

Tear down system and free all allocated memory

Public function Const

const EName ...

 

ToEName()

Get the EName that this FName represents or nullptr

Public function Const

void

 

ToString

(
    FUtf8StringBuilderBase& Out
)

Converts an FName to a readable format

Public function Const

void

 

ToString

(
    FWideStringBuilderBase& Out
)

Converts an FName to a readable format, in place

Public function Const

void

 

ToString

(
    FString& Out
)

Converts an FName to a readable format, in place

Public function Const

uint32

 

ToString

(
    TCHAR* Out,
    uint32 OutSize
)

Convert to string buffer to avoid dynamic allocations and returns string length

Public function Const

uint32

 

ToString

(
    TCHAR(&) Out
)

Public function Const

FString

 

ToString()

Converts an FName to a readable format

Public function Const

uint64

 

ToUnstableInt()

Returns an integer that compares equal in the same way FNames do, only usable within the current process

Public function Const

bool

 

TryAppendAnsiString

(
    FAnsiStringBuilderBase& Out
)

Converts an ANSI FName to a readable format appended to the string builder.

Operators

Name Description

Public function Const

bool

 

operator!=

(
    FName Other
)

Public function Const

bool

 

operator!=

(
    EName Ename
)

Public function Const

bool

 

operator!=

(
    const CharType* Other
)

Inequality operator.

Public function Const

bool

 

operator==

(
    EName Ename
)

Public function Const

bool

 

operator==

(
    const ANSICHAR* Other
)

Equality operator.

Public function Const

bool

 

operator==

(
    const WIDECHAR* Other
)

Public function Const

bool

 

operator==

(
    FName Other
)

Constants

Name

Description

StringBufferSize

Buffer size required for any null-terminated FName string, i.e. [name] '_' [digits] '\0'

Deprecated Functions

Name Description

Public function

 

FName

(
    const TCHAR* Name,
    int32 InNumber,
    EFindName FindType,
    bool bSplitName
)

EFindName has been removed from constructors taking a Number argument to add clarity around UE_FNAME_OUTLINE_NUMBER.

Public function

 

FName

(
    int32 Len,
    const UTF8CHAR* Name,
    int32 Number,
    EFindName FindType
)

EFindName has been removed from constructors taking a Number argument to add clarity around UE_FNAME_OUTLINE_NUMBER.

Public function

 

FName

(
    int32 Len,
    const ANSICHAR* Name,
    int32 Number,
    EFindName FindType
)

EFindName has been removed from constructors taking a Number argument to add clarity around UE_FNAME_OUTLINE_NUMBER.

Public function

 

FName

(
    int32 Len,
    const WIDECHAR* Name,
    int32 Number,
    EFindName FindType
)

EFindName has been removed from constructors taking a Number argument to add clarity around UE_FNAME_OUTLINE_NUMBER.

Public function

 

FName

(
    TStringView< UTF8CHAR > View,
    int32 InNumber,
    EFindName FindType
)

EFindName has been removed from constructors taking a Number argument to add clarity around UE_FNAME_OUTLINE_NUMBER.

Public function

 

FName

(
    TStringView< WIDECHAR > View,
    int32 InNumber,
    EFindName FindType
)

EFindName has been removed from constructors taking a Number argument to add clarity around UE_FNAME_OUTLINE_NUMBER.

Public function

 

FName

(
    TStringView< ANSICHAR > View,
    int32 InNumber,
    EFindName FindType
)

EFindName has been removed from constructors taking a Number argument to add clarity around UE_FNAME_OUTLINE_NUMBER.

Public function

 

FName

(
    const UTF8CHAR* Name,
    int32 Number,
    EFindName FindType
)

EFindName has been removed from constructors taking a Number argument to add clarity around UE_FNAME_OUTLINE_NUMBER.

Public function

 

FName

(
    const ANSICHAR* Name,
    int32 Number,
    EFindName FindType
)

EFindName has been removed from constructors taking a Number argument to add clarity around UE_FNAME_OUTLINE_NUMBER.

Public function

 

FName

(
    const WIDECHAR* Name,
    int32 Number,
    EFindName FindType
)

EFindName has been removed from constructors taking a Number argument to add clarity around UE_FNAME_OUTLINE_NUMBER.

Public function Const

Default lexi...

 

operator<

(
    const FName& Other
)

Please use FastLess() / FNameFastLess or LexicalLess() / FNameLexicalLess instead.

Public function Const

bool

 

operator>

(
    const FName& Other
)

Please use B.FastLess(A) or B.LexicalLess(A) instead of A > B.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Cancel