# String does not have a member named 'indexof'

**URL:** <https://forums.kodeco.com/t/string-does-not-have-a-member-named-indexof/9142>\
**Category:** 🎤 General Discussion\
**Created:** [March 11, 2016, 2:34am UTC](https://forums.kodeco.com/t/string-does-not-have-a-member-named-indexof/9142 "2016-03-11T02:34:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hunter\_1991](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/hunter_1991/32/7561_2.png) [@hunter\_1991](https://forums.kodeco.com/u/hunter_1991)\
**Post date:** [March 11, 2016, 2:34am UTC](https://forums.kodeco.com/t/string-does-not-have-a-member-named-indexof/9142/1 "2016-03-11T02:34:38Z")

</div>

i want to get the string row index which equals to the selectedgame

 ![](https://raywenderlich-com-v3-forums.s3.amazonaws.com/original/2X/2/2431c76841cb29bdb8c622b8b2d6f330333944ad.jpg)

---

<div class="post-metadata">

**Author:** ![narrativium](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/narrativium/32/110937_2.png) [@narrativium](https://forums.kodeco.com/u/narrativium)\
**Post date:** [March 11, 2016, 10:28am UTC](https://forums.kodeco.com/t/string-does-not-have-a-member-named-indexof/9142/2 "2016-03-11T10:28:46Z")

</div>

Arrays (any Indexable type) has a function called ‘indexOf’ (notice the capital O; Swift is case-sensitive).  
`selectedGameIndex = games.indexOf(game)` should what you want.

---

<div class="post-metadata">

**Author:** ![hunter\_1991](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/hunter_1991/32/7561_2.png) [@hunter\_1991](https://forums.kodeco.com/u/hunter_1991)\
**Post date:** [March 11, 2016, 4:12pm UTC](https://forums.kodeco.com/t/string-does-not-have-a-member-named-indexof/9142/3 "2016-03-11T16:12:15Z")

</div>

thank you so much！！！
