Language:
Discover
By Skill Level
By Category

FString

Choose your OS:

Inheritance Hierarchy

Syntax

class FString

Remarks

A dynamically sizeable string.

Constructors

Name Description

Public function

FString()

Public function

FString

(
    FString &&
)

Public function

FString

(
    const FString &
)

Public function

FString

(
    const FString & Other,
    int32 ExtraSlack
)

Create a copy of the Other string with extra space for characters at the end of the string

Public function

FString

(
    FString && Other,
    int32 ExtraSlack
)

Create a copy of the Other string with extra space for characters at the end of the string

Public function

FString

(
    const CharType* Src,
    typename TEnableIf < TIsCharType < Ch...
)

This TEnableIf is to ensure we don't instantiate this constructor for non-char types, like id* in Obj-C.

Public function

FString

(
    int32 InCount,
    const TCHAR * InSrc
)

Constructor to create FString with specified number of characters from another string with additional character zero

Functions

Name Description

Public function

FString &

 

Append

(
    const FString & Text
)

Public function

FString &

 

Append

(
    const TCHAR * Text,
    int32 Count
)

Public function

FString &

 

AppendChar

(
    const TCHAR InChar
)

Concatenate this with given char

reference to this

Public function

void

 

AppendChars

(
    const TCHAR * Array,
    int32 Count
)

Appends an array of characters to the string.

Public function

void

 

AppendInt

(
    int32 InNum
)

Appends the integer InNum to this string

Public function

void

 

CheckInvariants()

Run slow checks on this string

Public function Static

FString

 

Chr

(
    TCHAR Ch
)

String with Ch character

Public function Static

FString

 

ChrN

(
    int32 NumCharacters,
    TCHAR Char
)

Returns a string that is full of a variable number of characters

Public function

int32

 

Compare

(
    const FString & Other,
    ESearchCase::Type SearchCase
)

Lexicographically tests how this string compares to the Other given string

Public function

bool

 

Contains

(
    const TCHAR * SubStr,
    ESearchCase::Type SearchCase,
    ESearchDir::Type SearchDir
)

Returns whether this string contains the specified substring.

Public function

bool

 

Contains

(
    const FString & SubStr,
    ESearchCase::Type SearchCase,
    ESearchDir::Type SearchDir
)

Returns whether this string contains the specified substring.

Public function

FString

 

ConvertTabsToSpaces

(
    const int32 InSpacesPerTab
)

Replaces all instances of '' with TabWidth number of spaces

Public function

TConstIterat ...

 

CreateConstIterator()

Creates a const iterator for the characters in this string

Public function

TIterator

 

CreateIterator()

Creates an iterator for the characters in this string

Public function Static

int32

 

CullArray

(
    TArray < FString >* InArray
)

Takes an array of strings and removes any zero length entries.

Public function

void

 

Empty

(
    int32 Slack
)

Create empty string of given size with zero terminating character

Public function

bool

 

EndsWith

(
    const FString & InSuffix,
    ESearchCase::Type SearchCase
)

Test whether this string ends with given string.

Public function

bool

 

EndsWith

(
    const TCHAR * InSuffix,
    ESearchCase::Type SearchCase
)

Test whether this string ends with given string.

Public function

bool

 

Equals

(
    const FString & Other,
    ESearchCase::Type SearchCase
)

Lexicographically tests whether this string is equivalent to the Other given string

Public function

int32

 

Find

(
    const FString & SubStr,
    ESearchCase::Type SearchCase,
    ESearchDir::Type SearchDir,
    int32 StartPosition
)

Searches the string for a substring, and returns index into this string of the first found instance.

Public function

int32

 

Find

(
    const TCHAR * SubStr,
    ESearchCase::Type SearchCase,
    ESearchDir::Type SearchDir,
    int32 StartPosition
)

Searches the string for a substring, and returns index into this string of the first found instance.

Public function

bool

 

FindChar

(
    TCHAR InChar,
    int32 & Index
)

Searches the string for a character

true if character was found in this string, otherwise false

Public function

bool

 

FindLastChar

(
    TCHAR InChar,
    int32 & Index
)

Searches the string for the last occurrence of a character

Public function

int32

 

FindLastCharByPredicate

(
    Predicate Pred
)

Searches the string for the last occurrence of a character which matches the specified predicate.

Public function

int32

 

FindLastCharByPredicate

(
    Predicate Pred,
    int32 Count
)

Searches an initial substring for the last occurrence of a character which matches the specified predicate.

Public function Static

FString

 

Format

(
    const TCHAR * InFormatString,
    const TMap < FString , FStringFormatA ...
)

Format the specified string using the specified arguments.

Public function Static

FString

 

Format

(
    const TCHAR * InFormatString,
    const TArray < FStringFormatArg >& ...
)

Format the specified string using the specified arguments.

Public function Static

FString

 

FormatAsNumber

(
    int32 InNumber
)

Takes the number passed in and formats the string in comma format ( 12345 becomes "12,345")

Public function Static

FString

 

FromBlob

(
    const uint8 * SrcBuffer,
    const uint32 SrcSize
)

Converts a buffer to a string

the blob in string form

Public function Static

FString

 

FromHexBlob

(
    const uint8 * SrcBuffer,
    const uint32 SrcSize
)

Converts a buffer to a string by hex-ifying the elements

the blob in string form

Public function Static

FString

 

FromInt

(
    int32 Num
)

Converts an integer to a string.

Public function

uint32

 

GetAllocatedSize()

Public function

const DataTy ...

 

GetCharArray()

Get string as const array of TCHARS

Public function

DataType &

 

GetCharArray()

Get string as array of TCHARS

Public function

void

 

InsertAt

(
    int32 Index,
    TCHAR Character
)

Public function

void

 

InsertAt

(
    int32 Index,
    const FString & Characters
)

Public function

bool

 

IsEmpty()

Test whether this string is empty

true if this string is empty, otherwise return false.

Public function

bool

 

IsNumeric()

True if the string only contains numeric characters

Public function

bool

 

IsValidIndex

(
    int32 Index
)

Tests if index is valid, i.e. greater than or equal to zero, and less than the number of characters in this string (excluding the null terminator).

Public function Static

FString

 

Join

(
    const TSet < T, Allocator >& Set,
    const TCHAR * Separator
)

Joins a Set of 'something that can be concatentated to strings with +=' together into a single string with separators.

Public function Static

FString

 

Join

(
    const TArray < T, Allocator >& Arra...,
    const TCHAR * Separator
)

Joins an array of 'something that can be concatentated to strings with +=' together into a single string with separators.

Public function

FString

 

Left

(
    int32 Count
)

The left most given number of characters

Public function

FString

 

LeftChop

(
    int32 Count
)

The left most characters from the string chopping the given number of characters from the end

Public function

FString

 

LeftPad

(
    int32 ChCount
)

Pad the left of this string for ChCount characters

Public function

int32

 

Len()

Get the length of the string, excluding terminating character

Public function

bool

 

MatchesWildcard

(
    const FString & Wildcard,
    ESearchCase::Type SearchCase
)

Searches this string for a given wild card

Public function

FString

 

Mid

(
    int32 Start,
    int32 Count
)

The substring from Start position for Count characters.

Public function

int32

 

ParseIntoArray

(
    TArray < FString >& OutArray,
    const TCHAR * pchDelim,
    bool InCullEmpty
)

Breaks up a delimited string into elements of a string array.

The number of elements in InArray

Public function

int32

 

ParseIntoArray

(
    TArray < FString >& OutArray,
    const TCHAR ** DelimArray,
    int32 NumDelims,
    bool InCullEmpty
)

Breaks up a delimited string into elements of a string array, using the given delimiters

Public function

int32

 

ParseIntoArrayLines

(
    TArray < FString >& OutArray,
    bool InCullEmpty
)

Breaks up a delimited string into elements of a string array, using line ending characters

Public function

int32

 

ParseIntoArrayWS

(
    TArray < FString >& OutArray,
    const TCHAR * pchExtraDelim,
    bool InCullEmpty
)

Breaks up a delimited string into elements of a string array, using any whitespace and an optional extra delimter, like a ","

Public function

void

 

PathAppend

(
    const TCHAR * Str,
    int32 StrLength
)

Concatenate this path with given path ensuring the / character is used between them

Public function Static

FString

 

Printf

(
    const TCHAR * Fmt,
    ...
)

Constructs FString object similarly to how classic sprintf works.

Public function

void

 

RemoveAt

(
    int32 Index,
    int32 Count,
    bool bAllowShrinking
)

Removes characters within the string.

Public function

bool

 

RemoveFromEnd

(
    const FString & InSuffix,
    ESearchCase::Type SearchCase
)

Removes the text from the end of the string if it exists.

Public function

bool

 

RemoveFromStart

(
    const FString & InPrefix,
    ESearchCase::Type SearchCase
)

Removes the text from the start of the string if it exists.

Public function

FString

 

Replace

(
    const TCHAR * From,
    const TCHAR * To,
    ESearchCase::Type SearchCase
)

Replace all occurrences of a substring in this string

Public function

FString

 

ReplaceCharWithEscapedChar

(
    const TArray < TCHAR >* Chars
)

Replaces certain characters with the "escaped" version of that character (i.e. replaces "\n" with "\n").

Public function

FString

 

ReplaceEscapedCharWithChar

(
    const TArray < TCHAR >* Chars
)

Removes the escape backslash for all supported characters, replacing the escape and character with the non-escaped version.

Public function

int32

 

ReplaceInline

(
    const TCHAR * SearchText,
    const TCHAR * ReplacementText,
    ESearchCase::Type SearchCase
)

Replace all occurrences of SearchText with ReplacementText in this string.

Public function

FString

 

ReplaceQuotesWithEscapedQuotes()

Returns a copy of this string with all quote marks escaped (unless the quote is already escaped)

Public function

void

 

Reserve

(
    const uint32 CharacterCount
)

To allow more efficient memory handling, automatically adds one for the string termination.

Public function

void

 

Reset

(
    int32 NewReservedSize
)

Empties the string, but doesn't change memory allocation, unless the new size is larger than the current string.

Public function

FString

 

Reverse()

Returns a copy of this string, with the characters in reverse order

Public function

void

 

ReverseString()

Reverses the order of characters in this string

Public function

FString

 

Right

(
    int32 Count
)

The string to the right of the specified location, counting back from the right (end of the word).

Public function

FString

 

RightChop

(
    int32 Count
)

The string to the right of the specified location, counting forward from the left (from the beginning of the word).

Public function

FString

 

RightPad

(
    int32 ChCount
)

Pad the right of this string for ChCount characters

Public function Static

FString

 

SanitizeFloat

(
    double InFloat
)

Converts a float string with the trailing zeros stripped For example - 1.234 will be "1.234" rather than "1.234000"

Public function

void

 

SerializeAsANSICharArray

(
    FArchive & Ar,
    int32 MinCharacters
)

Serializes a string as ANSI char array.

Public function

void

 

Shrink()

Remove unallocated empty character space from the end of this string

Public function

bool

 

Split

(
    const FString & InS,
    FString * LeftS,
    FString * RightS,
    ESearchCase::Type SearchCase,
    ESearchDir::Type SearchDir
)

Splits this string at given string position case sensitive.

Public function

bool

 

StartsWith

(
    const FString & InPrefix,
    ESearchCase::Type SearchCase
)

Test whether this string starts with given string.

Public function

bool

 

StartsWith

(
    const TCHAR * InSuffix,
    ESearchCase::Type SearchCase
)

Test whether this string starts with given string.

Public function Static

bool

 

ToBlob

(
    const FString & Source,
    uint8 * DestBuffer,
    const uint32 DestSize
)

Converts a string into a buffer

true if the conversion happened, false otherwise

Public function

bool

 

ToBool()

Converts a string into a boolean value 1, "True", "Yes", GTrue, GYes, and non-zero integers become true 0, "False", "No", GFalse, GNo, and unparsable values become false

Public function Static

bool

 

ToHexBlob

(
    const FString & Source,
    uint8 * DestBuffer,
    const uint32 DestSize
)

Converts a string into a buffer

true if the conversion happened, false otherwise

Public function

FString

 

ToLower()

Converts all characters in this rvalue string to lowercase and moves it into the returned string.

Public function

FString

 

ToLower()

A new string with the characters of this converted to lowercase

Public function

void

 

ToLowerInline()

Converts all characters in this string to lowercase

Public function

FString

 

ToUpper()

A new string with the characters of this converted to uppercase

Public function

FString

 

ToUpper()

Converts all characters in this rvalue string to uppercase and moves it into the returned string.

Public function

void

 

ToUpperInline()

Converts all characters in this string to uppercase

Public function

FString

 

Trim()

Removes whitespace characters from the front of this string.

Public function

FString

 

TrimEnd()

Removes whitespace characters from the end of this string.

Public function

FString

 

TrimEnd()

Removes whitespace characters from the end of this string.

Public function

void

 

TrimEndInline()

Removes whitespace characters from the end of this string. Modifies the string in-place.

Public function

FString

 

TrimQuotes

(
    bool* bQuotesRemoved
)

Returns a copy of this string with wrapping quotation marks removed.

Public function

FString

 

TrimStart()

Removes whitespace characters from the start of this string.

Public function

FString

 

TrimStart()

Removes whitespace characters from the start of this string.

Public function

FString

 

TrimStartAndEnd()

Removes whitespace characters from the start and end of this string.

Public function

FString

 

TrimStartAndEnd()

Removes whitespace characters from the start and end of this string.

Public function

void

 

TrimStartAndEndInline()

Removes whitespace characters from the start and end of this string. Modifies the string in-place.

Public function

void

 

TrimStartInline()

Removes whitespace characters from the start of this string. Modifies the string in-place.

Public function

void

 

TrimToNullTerminator()

Trims the inner array after the null terminator.

Public function

FString

 

TrimTrailing()

Removes trailing whitespace characters

Operators

Name Description

Public function

const TCHAR ...

 

operator*()

Get pointer to the string

Pointer to Array of TCHAR if Num, otherwise the empty string

Public function

FString &

 

operator/=

(
    const FString & Str
)

Concatenate this path with given path ensuring the / character is used between them

Public function

FString &

 

operator/=

(
    const TCHAR * Str
)

Concatenate this path with given path ensuring the / character is used between them

Public function

TCHAR &

 

operator[]

(
    int32 Index
)

Return specific character from this string

Character at Index

Public function

const TCHAR ...

 

operator[]

(
    int32 Index
)

Return specific const character from this string

const Character at Index

Public function

FString &

 

operator+=

(
    const TCHAR * Str
)

Concatenate this with given string

reference to this

Public function

FString &

 

operator+=

(
    const FString & Str
)

Concatenate this with given string

reference to this

Public function

TEnableIf < T ...

 

operator+=

(
    CharType InChar
)

Concatenate this with given char

reference to this

Public function

FString &

 

operator=

(
    const TCHAR * Other
)

Copy Assignment from array of TCHAR

Public function

FString &

 

operator=

(
    const FString &
)

Public function

FString &

 

operator=

(
    FString &&
)

Typedefs

Name

Description

DataType

Array holding the character data

ElementType

TConstIterator

TIterator

Iterator typedefs

See Also

References

Module

Core

Header

Runtime/Core/Public/Containers/UnrealString.h