UBlueprintPathsLibrary::RemoveDuplicateSlashes
#include "Kismet/BlueprintPathsLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Collapses any run of consecutive slashes in a path down to a single slash.
Caveats & Gotchas
- • Assumes all slashes have already been converted to '/' — run NormalizeFilename first if the path may still contain backslashes.
- • The result is returned via the OutPath output parameter, not the return value.
Signature
static void RemoveDuplicateSlashes(const FString& InPath, FString& OutPath) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InPath | const FString& | A path that may contain duplicate consecutive slashes, e.g. "BaseDirectory/SomeDirectory//SomeOtherDirectory////Filename.ext". | — |
| OutPath | FString& | Receives the path with duplicate slashes collapsed to single slashes. | — |
Return Type
void Example
Collapse duplicate slashes C++
FString Cleaned;
UBlueprintPathsLibrary::RemoveDuplicateSlashes(TEXT("BaseDirectory/SomeDirectory//SomeOtherDirectory////Filename.ext"), Cleaned);
// Cleaned == TEXT("BaseDirectory/SomeDirectory/SomeOtherDirectory/Filename.ext") See Also
Tags
Version History
Introduced in: 4.20
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?