RealDocs

UBlueprintPathsLibrary::GetExtension

function Engine Blueprint Since 4.20
#include "Kismet/BlueprintPathsLibrary.h"
Access: public Specifiers: staticUFUNCTIONBlueprintPure

Description

Gets the extension for the given filename, or an empty string if it has none.

Caveats & Gotchas

  • By default the dot is stripped, so "Level.umap" returns "umap", not ".umap" — pass bIncludeDot=true if you need to compare against strings that include the dot.
  • Comparison is purely based on the last '.' in the string; paths with dots in a directory name but no real extension will produce a misleading result.

Signature

static FString GetExtension(const FString& InPath, bool bIncludeDot = false)

Parameters

Name Type Description Default
InPath const FString& The path or filename to extract the extension from.
bIncludeDot bool If true, includes the leading dot in the result. false

Return Type

FString

Example

Get a file's extension C++
FString Ext = UBlueprintPathsLibrary::GetExtension(TEXT("Content/Textures/Rock.png"));
// Ext == TEXT("png")

Version History

Introduced in: 4.20

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.