|
finding a substring in an array?
ok so i have it so that ill type a command in like /ban @name and itll
take everything after @ and put it into a variable (substring method).
i also have a users list which takes down everyones user name and user id in the chat room im in and puts it into an array in the format name=userid
so lets say someone is represented in the userlist array as
johnson = 1000000000
if i try to use array.indexOf(substring) it returns -1 every time....
even if substring = johnson
so long story short my question is how would i compare my substring to the users list and have it find their name which is attached to their user id and give me the index location of their name, strip the user id out of it and put it into a different array.
|