Subj : Match getstr() to object
To   : All
From : Ephram
Date : Thu Jun 04 2020 11:53 am

I have a script that gets a partial string that needs to be matched against an
object/array.

var names = {
AD:"Andorra",
AE:"United Arab Emirates",
AF:"Afghanistan",
AG:"Antigua and Barbuda",
AI:"Anguilla", ... };

write(' \1cEnter Country Name to Lookup \1w');
               var lookup = console.getstr();
               writeln('\r\n \1cLooking up  \1w'+ lookup);
               for(var i = 0; i <= names.length; i++) {
                       if(names[i][1].toUpperCase() ===
indexOf(lookup).toUpperCase()) {
                               writeln(' Found ' + names[i] + ' ' +
names[i][0] + ' ' + names[i][1]);
                       }
               }

if I enter, say lookup = 'Andor' it doesn't find anything ...

any help would be appreciated :)


My doctor said I have the body of a 25 year old ... and the mind of a 10 :-/

---
� Synchronet � Realm of Dispair BBS - http://ephram.synchro.net:82