Home   Help Search Login Register  

Author Topic: ARRAYS; GETTING ELEMENT NUMBER  (Read 506 times)

0 Members and 1 Guest are viewing this topic.

Offline ZNorQ

  • Members
  • *
  • ehr... uhm... duh...
ARRAYS; GETTING ELEMENT NUMBER
« on: 16 May 2004, 20:27:32 »
Hey,

The "In" function is nice for checking for a specific element in an array - but how can I get the position number of an element in an array?

Example;

["Cake", "Coffee", "Bread", "Milk"]

Lets say I want the position number for "Bread". I know I can use
"Bread" in ["Cake", "Coffee", "Bread", "Milk"] to find out that it exists...

What would be nice is if "in" returned the position if it existed, instead
of a boolean result.

Anyone?

ZNorQ

Offline ZNorQ

  • Members
  • *
  • ehr... uhm... duh...
Re:ARRAYS; GETTING ELEMENT NUMBER
« Reply #1 on: 16 May 2004, 20:39:08 »
Forget it ppl! Found a function (indexOf)..! He who looks, finds... maybe..

ZNorQ