RealDocs

UKismetStringLibrary::Contains

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

Description

Returns whether SearchIn contains Substring, optionally searching case-sensitively and/or from the end.

Caveats & Gotchas

  • bUseCase defaults to false, meaning the comparison is case-insensitive by default — the opposite of what the parameter name suggests at a glance.
  • bSearchFromEnd only changes where the search starts scanning internally; it never changes the true/false result.

Signature

static bool Contains(const FString& SearchIn, const FString& Substring, bool bUseCase = false, bool bSearchFromEnd = false)

Parameters

Name Type Description Default
SearchIn const FString& The string to search within.
Substring const FString& The string to search for.
bUseCase bool Whether or not to search case-sensitively. false
bSearchFromEnd bool Whether or not to start the search from the end of the string instead of the beginning. false

Return Type

bool

Example

Check for a keyword in chat text C++
if (UKismetStringLibrary::Contains(ChatMessage, TEXT("help")))
{
    ShowHelpPrompt();
}

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.