# Getting position of string in array?

**URL:** https://forum.kirupa.com/t/getting-position-of-string-in-array/86909
**Category:** Uncategorized
**Created:** [April 16, 2005, 5:13pm UTC](https://forum.kirupa.com/t/getting-position-of-string-in-array/86909 "2005-04-16T17:13:32Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![MrFlashALot](https://avatars.discourse-cdn.com/v4/letter/m/cdc98d/32.png) [@MrFlashALot](https://forum.kirupa.com/u/MrFlashALot)
#### Post date: [April 16, 2005, 5:13pm UTC](https://forum.kirupa.com/t/getting-position-of-string-in-array/86909/1 "2005-04-16T17:13:32Z")

</div>

Can anybody help me figure out how I can get the position of a string inside an array.

For instance,

myArray[“hello”, “goodbye”, “sayonara”];

myString = “goodbye”;

Whats the simplest way to get the index in myArray that myString occupies (ie. 1)? Something like the string-method indexOf() but for arrays would be great…
