# Wiki Code Tutorials

**URL:** <https://forums.unrealengine.com/t/wiki-code-tutorials/256>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [March 20, 2014, 9:39pm UTC](https://forums.unrealengine.com/t/wiki-code-tutorials/256 "2014-03-20T21:39:34Z")\
**Posts on this page:** 1\
**Showing post:** 292

<div class="post-metadata">

**Author:** ![Rama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rama/32/882413_2.png) [@Rama](https://forums.unrealengine.com/u/Rama)\
**Post date:** [December 25, 2015, 3:08pm UTC](https://forums.unrealengine.com/t/wiki-code-tutorials/256/292 "2015-12-25T15:08:19Z")

</div>

Get Enum From String

Dear Community,

I’ve added a new entry to my UE4 C++ Enum wiki!

I am giving you the code to get an enum value back from a string, after it was initially converted to a string!

**UE4 Wiki Link**

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — https://unrealcommunity.wiki/! You will be able to find content from...

```auto

emplate <typename EnumType>
static FORCEINLINE EnumType GetEnumValueFromString(const FString& EnumName, const FString& String)
{ 
	UEnum* Enum = FindObject<UEnum>(ANY_PACKAGE, *EnumName, true);
	if(!Enum) 
        { 
          return EnumType(0);
        }		
	return (EnumType)Enum->FindEnumIndex(FName(*String));
}
 
//Sample Usage
EChallenge ChallengeEnumValue = //Initial Value

FString ParseLine = GetEnumValueAsString<EChallenge>("EChallenge", ChallengeEnumValue))); //To String

EChallenge Challenge = GetEnumValueFromString<EChallenge>("EChallenge", ParseLine); //Back From String!

```

Enjoy!

---

_[View the full topic](https://forums.unrealengine.com/t/wiki-code-tutorials/256)._
