# How to get a string property by name

**URL:** <https://forums.unrealengine.com/t/how-to-get-a-string-property-by-name/266008>\
**Category:** C++\
**Tags:** General, unreal-engine, UE4-26, question\
**Created:** [December 13, 2021, 12:39pm UTC](https://forums.unrealengine.com/t/how-to-get-a-string-property-by-name/266008 "2021-12-13T12:39:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![somawheels](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@somawheels](https://forums.unrealengine.com/u/somawheels)\
**Post date:** [December 13, 2021, 12:39pm UTC](https://forums.unrealengine.com/t/how-to-get-a-string-property-by-name/266008/1 "2021-12-13T12:39:53Z")

</div>

I Am using this code to get an int property by name.

```auto
bool UMyBPFunctions::GetIntByName(UObject* Target, FName VarName, int& out)
{
    if (Target) 
    {
        FProperty* property = Target->GetClass()->FindPropertyByName(VarName);
        if (!property)
        {
            return false;
        }
        FIntProperty* typedProperty = CastField<FIntProperty>(property);
        if (!typedProperty)
        {
            return false;
        }

        void* propertyAddress = property->ContainerPtrToValuePtr<void>(Target);

        out = typedProperty->GetPropertyValue(propertyAddress);
        return true;
    }
    return false;
}

```

Does anyone know how I would do the same for an FString?

---

<div class="post-metadata">

**Author:** ![NilsonLima](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NilsonLima](https://forums.unrealengine.com/u/NilsonLima)\
**Post date:** [December 13, 2021, 1:11pm UTC](https://forums.unrealengine.com/t/how-to-get-a-string-property-by-name/266008/2 "2021-12-13T13:11:00Z")

</div>

Just replace the FIntProperty with FStrProperty

[https://docs.unrealengine.com/4.27/en-US/API/Runtime/CoreUObject/UObject/FStrProperty/](https://docs.unrealengine.com/4.27/en-US/API/Runtime/CoreUObject/UObject/FStrProperty/)

---

<div class="post-metadata">

**Author:** ![somawheels](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@somawheels](https://forums.unrealengine.com/u/somawheels)\
**Post date:** [December 13, 2021, 1:20pm UTC](https://forums.unrealengine.com/t/how-to-get-a-string-property-by-name/266008/3 "2021-12-13T13:20:21Z")

</div>

Thanks so much
