{"id":9917,"date":"2024-04-18T12:22:43","date_gmt":"2024-04-18T10:22:43","guid":{"rendered":"https:\/\/store.algosyntax.com\/?post_type=asx-lms-tutorial-cpt&#038;p=9917"},"modified":"2026-03-09T14:10:30","modified_gmt":"2026-03-09T12:10:30","slug":"ue5-converting-enums-to-fstring-in-c","status":"publish","type":"asx-lms-tutorial-cpt","link":"https:\/\/store.algosyntax.com\/tutorials\/unreal-engine\/ue5-converting-enums-to-fstring-in-c\/","title":{"rendered":"UE5 Converting Enums to FString In C++"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"9917\" class=\"elementor elementor-9917\" data-elementor-post-type=\"asx-lms-tutorial-cpt\">\n\t\t\t\t<div class=\"elementor-element elementor-element-4e925ce e-flex e-con-boxed e-con e-parent\" data-id=\"4e925ce\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-f4faa57 elementor-widget elementor-widget-text-editor\" data-id=\"f4faa57\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<p>Sometimes you may need to convert an enum to a string without using switch or if else blocks. Here&#8217;s a generic way of converting any UEnum to FString:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a848ed7 elementor-widget elementor-widget-code-highlight\" data-id=\"a848ed7\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-cpp line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-cpp\">\n\t\t\t\t\t<xmp>UENUM(BlueprintType)\nenum class MyEnum : uint8\n{\n\tNone\t\t\t UMETA(DisplayName = \"(none)\"),\n\tQuarter\t\t\t UMETA(DisplayName = \"1\/4\")\n}\n\nauto MyEnumValue=MyEnum::Quarter;\n\n\/\/This will get the \"DisplayName\" of the Enum. Eg \"1\/4)\nUEnum::GetDisplayValueAsText(MyEnumValue).ToString();\n\n\/\/This gets the Name of the enum, eg \"Quarter\"\nUEnum::GetValueAsString(MyEnumValue); \n\n<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"featured_media":0,"template":"","asx-lms-tutorial-categories":[58],"asx-lms-tutorial-tags":[46],"class_list":["post-9917","asx-lms-tutorial-cpt","type-asx-lms-tutorial-cpt","status-publish","hentry","asx-lms-tutorial-categories-unreal-c-api","asx-lms-tutorial-tags-cpp","entry"],"acf":[],"_links":{"self":[{"href":"https:\/\/store.algosyntax.com\/asx-rest\/wp\/v2\/asx-lms-tutorial-cpt\/9917","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/store.algosyntax.com\/asx-rest\/wp\/v2\/asx-lms-tutorial-cpt"}],"about":[{"href":"https:\/\/store.algosyntax.com\/asx-rest\/wp\/v2\/types\/asx-lms-tutorial-cpt"}],"version-history":[{"count":0,"href":"https:\/\/store.algosyntax.com\/asx-rest\/wp\/v2\/asx-lms-tutorial-cpt\/9917\/revisions"}],"wp:attachment":[{"href":"https:\/\/store.algosyntax.com\/asx-rest\/wp\/v2\/media?parent=9917"}],"wp:term":[{"taxonomy":"asx-lms-tutorial-categories","embeddable":true,"href":"https:\/\/store.algosyntax.com\/asx-rest\/wp\/v2\/asx-lms-tutorial-categories?post=9917"},{"taxonomy":"asx-lms-tutorial-tags","embeddable":true,"href":"https:\/\/store.algosyntax.com\/asx-rest\/wp\/v2\/asx-lms-tutorial-tags?post=9917"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}