Static Public Member Functions | List of all members
UBPUtilsStringLibrary Class Reference

Static Public Member Functions

static FString JoinString (const FString &A, const FString &B, const FString &Sep="")
 Joins the given strings with an optional separator. More...
 
static bool IsStringEmpty (const FString &Input)
 Checks if the string is empty. More...
 
static bool IsStringNotEmpty (const FString &Input)
 Checks if the string is not empty. More...
 
static FString PadStringLeftWithFiller (const FString Input, const int32 Length, FString Filler=FString(" "))
 Pads a string to a certain length with the provided filler. More...
 
static FString PadStringRightWithFiller (const FString Input, const int32 Length, FString Filler=FString(" "))
 Pads a string to a certain length with the provided filler. More...
 
static TArray< FString > ExplodeString (const FString Input, const FString Separator)
 Splits a string at every occurance of the given separator and returns the pieces as an array. More...
 
static FString SurroundString (const FString Prefix, const FString Input, const FString Suffix)
 Surrounds the given string with an optional prefix and suffix. More...
 
static FString FloatToStringWithPrecision (const float Input, const int32 FractionalDigits)
 Returns a string representation of a float, with the specified precision. More...
 

Member Function Documentation

◆ ExplodeString()

TArray< FString > UBPUtilsStringLibrary::ExplodeString ( const FString  Input,
const FString  Separator 
)
static

Splits a string at every occurance of the given separator and returns the pieces as an array.

Parameters
InputThe input string
SeparatorThe separator to split at
Returns
The split pieces of the string
string-explode.png

◆ FloatToStringWithPrecision()

FString UBPUtilsStringLibrary::FloatToStringWithPrecision ( const float  Input,
const int32  FractionalDigits 
)
static

Returns a string representation of a float, with the specified precision.

Parameters
InputThe input string
FractionalDigitsNumber of digits after the decimal
Returns
String with the specified precision
string-floatwithprecision.png

◆ IsStringEmpty()

bool UBPUtilsStringLibrary::IsStringEmpty ( const FString &  Input)
static

Checks if the string is empty.

Parameters
InputThe input string
Returns
True if the given string is empty (len == 0).
string-empty.png

◆ IsStringNotEmpty()

bool UBPUtilsStringLibrary::IsStringNotEmpty ( const FString &  Input)
static

Checks if the string is not empty.

Parameters
InputThe input string
Returns
True if the given string is not empty (len != 0).
string-any.png

◆ JoinString()

FString UBPUtilsStringLibrary::JoinString ( const FString &  A,
const FString &  B,
const FString &  Sep = "" 
)
static

Joins the given strings with an optional separator.

Parameters
ALeft string operand
BRight string operand
SepOptional separator
Returns
The two strings joined, with the separator in the middle, if provided (a + sep + b).
string-join.png

◆ PadStringLeftWithFiller()

FString UBPUtilsStringLibrary::PadStringLeftWithFiller ( const FString  Input,
const int32  Length,
FString  Filler = FString(" ") 
)
static

Pads a string to a certain length with the provided filler.

Adds filler on the left side of the string. Filler defaults to a space (" ") if not provided. If len(input+(filler*n)) != output length, the filler will be truncated ("foo" -> pad with "-=" to 10 -> "-=-=-=-foo").

Parameters
InputThe input string
LengthThe desired length
FillerThe string to fill the padded space with
Returns
The string padded to the given length
string-pad-left.png

◆ PadStringRightWithFiller()

FString UBPUtilsStringLibrary::PadStringRightWithFiller ( const FString  Input,
const int32  Length,
FString  Filler = FString(" ") 
)
static

Pads a string to a certain length with the provided filler.

Adds filler on the right side of the string. Filler defaults to a space (" ") if not provided. If len(input+(filler*n)) != output length, the filler will be truncated ("foo" -> pad with "-=" to 10 -> "foo-=-=-=-").

Parameters
InputThe input string
LengthThe desired length
FillerThe string to fill the padded space with
Returns
The string padded to the given length
string-pad-right.png

◆ SurroundString()

FString UBPUtilsStringLibrary::SurroundString ( const FString  Prefix,
const FString  Input,
const FString  Suffix 
)
static

Surrounds the given string with an optional prefix and suffix.

Parameters
PrefixThe input string
InputThe input string
SuffixThe separator to split at
Returns
prefix + input + suffix
string-surround.png