RealDocs

UKismetStringLibrary::ReplaceInline

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

Description

Replaces all occurrences of SearchText with ReplacementText directly in SourceString and returns how many replacements were made.

Caveats & Gotchas

  • SourceString is a UPARAM(ref) — it's mutated in place, so this is not marked BlueprintPure and must be wired as an executable node in Blueprint.
  • Unlike Replace, the return value here is the replacement count, not the resulting string; read the modified SourceString pin/reference for the text.

Signature

static int32 ReplaceInline(UPARAM(ref) FString& SourceString, const FString& SearchText, const FString& ReplacementText, ESearchCase::Type SearchCase = ESearchCase::IgnoreCase)

Parameters

Name Type Description Default
SourceString FString& The string to modify in place.
SearchText const FString& The text to remove from SourceString.
ReplacementText const FString& The text to insert in its place.
SearchCase ESearchCase::Type Whether the search for SearchText is case-sensitive. ESearchCase::IgnoreCase

Return Type

int32

Example

Strip a token and count occurrences C++
FString Text = TEXT("a_b_c_d");
const int32 Count = UKismetStringLibrary::ReplaceInline(Text, TEXT("_"), TEXT(" "));
// Text == "a b c d", Count == 3

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.