![]() Preserved Topic: IndexOf problem (Page 1 of 1) |
|
---|---|
Obsessive-Compulsive (I) Inmate From: Preston, Lancashire, England |
![]() I'm having problems returning the index of a letter in a string correctly. code: letters = new Array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',' ');
|
Neurotic (0) Inmate Newly admitted |
![]() what i would do is this: |
Maniac (V) Mad Scientist From: Belgrade, Serbia |
![]() John H, I have tested the code from above and it worked fine. BUT, it won't do what you want; join() function will create string from array elements, but they will be separated by commas and using indeOf() on that string will return number that won't corespond to the actual index in array. You have to strip all commas before using indexOf() function... |
Bipolar (III) Inmate From: London, UK |
![]() You could just use join with an empty string seperator... |
Obsessive-Compulsive (I) Inmate From: Preston, Lancashire, England |
![]() I went with the string idea (letters = "abcd...") and it's all sorted out now. |