View Single Post
Old 10-08-2012, 11:59 PM   PM User | #1
nachos
New to the CF scene

 
Join Date: Oct 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
nachos is an unknown quantity at this point
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.
nachos is offline   Reply With Quote