RealDocs

UKismetTextLibrary::TextTrimPrecedingAndTrailing

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

Description

Removes whitespace characters from the front and end of the text.

Caveats & Gotchas

  • This is the most commonly used of the three trim functions — reach for it by default unless you specifically need one-sided trimming.
  • Internal whitespace between words is left untouched; this only strips the leading and trailing edges.

Signature

static FText TextTrimPrecedingAndTrailing(const FText& InText)

Parameters

Name Type Description Default
InText const FText& The text to trim.

Return Type

FText

Example

Sanitize a player-entered name C++
FText RawName = NameInputBox->GetText();
FText CleanName = UKismetTextLibrary::TextTrimPrecedingAndTrailing(RawName);
if (UKismetTextLibrary::TextIsEmpty(CleanName))
{
    ShowValidationError();
}

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.