UKismetStringLibrary::GetSubstring
#include "Kismet/KismetStringLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Returns a substring from SourceString starting at StartIndex and spanning Length characters.
Caveats & Gotchas
- • StartIndex and Length are silently clamped to the valid range rather than asserting, so out-of-range values return a truncated or empty string instead of an error.
- • Length defaults to 1, so forgetting to set it returns only a single character — easy to miss since the default isn't visible on a collapsed Blueprint node.
Signature
static FString GetSubstring(const FString& SourceString, int32 StartIndex = 0, int32 Length = 1) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| SourceString | const FString& | The string to get the substring from. | — |
| StartIndex | int32 | The location in SourceString to use as the start of the substring. | 0 |
| Length | int32 | The length of the requested substring. | 1 |
Return Type
FString Example
Get the first three characters C++
FString Prefix = UKismetStringLibrary::GetSubstring(PlayerName, 0, 3); Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?