# FString from a single TCHAR

**URL:** <https://forums.unrealengine.com/t/fstring-from-a-single-tchar/629217>\
**Category:** C++\
**Tags:** unreal-engine, UE5-0, CPP, question\
**Created:** [August 16, 2022, 3:45am UTC](https://forums.unrealengine.com/t/fstring-from-a-single-tchar/629217 "2022-08-16T03:45:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![KaidoomDev](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kaidoomdev/32/977996_2.png) [@KaidoomDev](https://forums.unrealengine.com/u/KaidoomDev)\
**Post date:** [August 16, 2022, 3:45am UTC](https://forums.unrealengine.com/t/fstring-from-a-single-tchar/629217/1 "2022-08-16T03:45:10Z")

</div>

Hi,

I’ve been trying to find a way to construct a FString from a single TCHAR so far this is what I’ve come up with and I’d like to know if you guys have any better methods.

First method:

```auto
TCHAR c = 'A';
FString str = FString(1, &c);

UE_LOG(LogTemp, Warning, TEXT("%s"), *str);

```

Second method using TArray

```auto
TCHAR c = 'A';
TArray<TCHAR> arr = { c, '\0'}; //null terminator needed.
TCHAR* ArrPtr = &arr[0];
FString str = ArrPtr;

UE_LOG(LogTemp, Warning, TEXT("%s"), *str);

```

Edit:  
Second method I can also use instead of TArray I guess.  
`TCHAR arr[] = {c, '\0'};`

Third method:

```auto
FString str;
str.AppendChar(c);

```

Thank you.

---

<div class="post-metadata">

**Author:** ![Shmoopy1701](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shmoopy1701/32/1194536_2.png) [@Shmoopy1701](https://forums.unrealengine.com/u/Shmoopy1701)\
**Post date:** [August 16, 2022, 4:29am UTC](https://forums.unrealengine.com/t/fstring-from-a-single-tchar/629217/2 "2022-08-16T04:29:31Z")

</div>

Couple more ways this this thread:

[Convert std::string to FString - Programming & Scripting / C++ - Unreal Engine Forums](https://forums.unrealengine.com/t/convert-std-string-to-fstring/5065/2)

Although I’d suggest using nothing other than FStrings if it can be avoided.

---

<div class="post-metadata">

**Author:** ![KaidoomDev](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kaidoomdev/32/977996_2.png) [@KaidoomDev](https://forums.unrealengine.com/u/KaidoomDev)\
**Post date:** [August 16, 2022, 4:58am UTC](https://forums.unrealengine.com/t/fstring-from-a-single-tchar/629217/3 "2022-08-16T04:58:30Z")

</div>

Thanks for replying. That thread has some good info but I couldn’t see anything related to one single TCHAR to FString.  
I also agree I’d rather stay within the scope of unreal engine types.

Thanks again.

---

<div class="post-metadata">

**Author:** ![ervin](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ervin/32/948709_2.png) [@ervin](https://forums.unrealengine.com/u/ervin)\
**Post date:** [March 2, 2025, 7:37pm UTC](https://forums.unrealengine.com/t/fstring-from-a-single-tchar/629217/5 "2025-03-02T19:37:32Z")

</div>

if you’re specifically intending to print this TCHAR variable to the log, you can format it like this:

```auto
TCHAR c = 'A';
UE_LOG(LogTemp, Warning, TEXT("%c"), c);

```
