What is the behavior of Fstring = FString?

I’ve been struggling to find any documentation on this and it doesn’t seem like anyone has asked this before, so I wanted to know: How does Unreal Engine interpret this? Would it copy the contents of the assignee string into the assigned string, or would the assigned string become a reference to the assignee string?

As an example, lets say you had the following code:

FString str1 = FString(TEXT("This is some text.");
FString str2 = str1;
FString str3 = FString(TEXT("This is some more text.");

str2.AppendChars(*str3, str3.Len());

Would str1 contain “This is some text.”, or would it contain “This is some text.This is some more text.”?

Thank you to anyone who can clarify this behavior!

Greetings @IronFishJmp0

Welcome to the Unreal Engine Forum! The documentation you’re looking for is probably this one: FString - Unreal Engine Documentation. I hope that is what you were looking for. Let me know! Thanks!

Thank you for the reply Jas. I have read the documentation you mentioned but as far as I can tell, it does not specify what the behavior I listed above is though.

Since posting this I’ve learned that using the FString constructor on an existing FString produces a copy of it, but I still have no idea what a naked assignment does.

Constructor example:

FString str1 = FString(TEXT("Hello ");
FString str2 = FString(str1);
FString str3 = FString(TEXT("World!");

str2.AppendChars(*str3, str3.Len());

str2 should contain “Hello World!” and str1 should still contain "Hello "

I also realize now it might be helpful to specify I’m using unreal engine 5.4, not unreal engine 4. I have looked at the documentation for UE5.4 and it also doesn’t specify what this behavior is either though (again unless I missed it).

I recall running into the first time in Python. I’ll take a look and see if I can pull some additional information on it for.