# Get struct item from array by string

**URL:** <https://forums.unrealengine.com/t/get-struct-item-from-array-by-string/437216>\
**Category:** Blueprint\
**Tags:** tarray:-arrays-in-un, unreal-engine, UE4, Blueprint, question, slot-name\
**Created:** [November 7, 2018, 9:37pm UTC](https://forums.unrealengine.com/t/get-struct-item-from-array-by-string/437216 "2018-11-07T21:37:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_07095828](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_07095828](https://forums.unrealengine.com/u/anonymous_user_07095828)\
**Post date:** [November 7, 2018, 9:37pm UTC](https://forums.unrealengine.com/t/get-struct-item-from-array-by-string/437216/1 "2018-11-07T21:37:00Z")

</div>

Hi,

i have a costum struct like this:

vector : worldLocation

string : name

and i have an array with these structure and a second array with the names that i need to find from the struct array.

How can i get all items from the array only by the “string name”?  
For example the name array is : house1, house2, road2. How to find all items from the struct array with these names?

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [November 7, 2018, 11:13pm UTC](https://forums.unrealengine.com/t/get-struct-item-from-array-by-string/437216/2 "2018-11-07T23:13:46Z")

</div>

What you looking for is probably maps, they are key/value array and they are optimized on C++ level in any array management based on any type of key like String. They recently (well few version back so not that recent anymore) got blueprint support. It always better then doing setup on your own

> **[TMap](https://docs.unrealengine.com/5.1/en-US/map-containers-in-unreal-engine/)**
>
> TMaps are primarily defined by two types — a key type and a value type — which are stored as associated pairs in the map.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [November 8, 2018, 8:42am UTC](https://forums.unrealengine.com/t/get-struct-item-from-array-by-string/437216/3 "2018-11-08T08:42:02Z")

</div>

Also, [DataTable](https://docs.unrealengine.com/en-us/Gameplay/DataDriven) - a glorified struct editor - can fetch structs (or other struct arrays) by name.
