RealDocs

UKismetStringLibrary::Replace

function Engine Blueprint Since unknown
#include "Kismet/KismetStringLibrary.h"
Access: public Specifiers: staticBlueprintPure

Description

Returns a new copy of a string with all occurrences of one substring replaced by another. This is the non-mutating counterpart to ReplaceInline.

Caveats & Gotchas

  • Returns a new FString and leaves SourceString untouched — unlike ReplaceInline, nothing is modified in place.
  • If From is empty, no replacement occurs and the original string is returned unchanged rather than inserting To between every character.

Signature

static FString Replace(const FString& SourceString, const FString& From, const FString& To, ESearchCase::Type SearchCase = ESearchCase::IgnoreCase)

Parameters

Name Type Description Default
SourceString const FString& The string to search within.
From const FString& The substring to replace.
To const FString& The substring to insert in its place.
SearchCase ESearchCase::Type Whether the search for From is case-sensitive. ESearchCase::IgnoreCase

Return Type

FString

Example

Replace a placeholder token C++
FString Message = UKismetStringLibrary::Replace(TEXT("Hello {Name}"), TEXT("{Name}"), PlayerName);

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.