UKismetStringLibrary::Split
#include "Kismet/KismetStringLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Splits a string into a left and right part around the first (or last) occurrence of a delimiter. Commonly used to split a single "Key=Value" style pair.
Caveats & Gotchas
- • LeftS and RightS are only updated if the delimiter is actually found — on failure they retain their previous values, so initialize them or check the bool return before using them.
- • For splitting on every occurrence of a delimiter into many pieces, use ParseIntoArray instead; Split only produces two output strings.
Signature
static bool Split(const FString& SourceString, const FString& InStr, FString& LeftS, FString& RightS, ESearchCase::Type SearchCase = ESearchCase::IgnoreCase, ESearchDir::Type SearchDir = ESearchDir::FromStart) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| SourceString | const FString& | The string to split. | — |
| InStr | const FString& | The delimiter string to split on. | — |
| LeftS | FString& | Receives the portion of SourceString to the left of InStr. | — |
| RightS | FString& | Receives the portion of SourceString to the right of InStr. | — |
| SearchCase | ESearchCase::Type | Whether the search for InStr is case-sensitive. | ESearchCase::IgnoreCase |
| SearchDir | ESearchDir::Type | Whether to search from the start or the end of SourceString. | ESearchDir::FromStart |
Return Type
bool Example
Split a key=value pair C++
FString Key, Value;
if (UKismetStringLibrary::Split(TEXT("Health=100"), TEXT("="), Key, Value))
{
// Key == "Health", Value == "100"
} See Also
Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?