views:

70

answers:

2

Hi all can you help me out through this question!!!

+2  A: 

I think you could start by looking how to access files from javascript

Then use a Regular expression to get only Uppercase words

Finally remove duplicates from your results.

Hope it helps you

SDReyes
+2  A: 

Use Regular Expressions for extracting uppercase words. For unique words there's no out of the box functionality. You need to write your own function. Try iterating through each word and if unique put it in an array, something similar.

For reading from a file use XMLHttpRequest. Try this:

 /*fname - relative path to the file9.callback - function to call with file text*/

function readFileHttp(fname, callback) {
   xmlhttp = getXmlHttp();
   xmlhttp.onreadystatechange = function() {
      if (xmlhttp.readyState==4) { 
          callback(xmlhttp.responseText); 
      }
   }
   xmlhttp.open("GET", fname, true);
   xmlhttp.send(null);
}

/*
Return a cross-browser xmlhttp request object
*/
function getXmlHttp() {
   if (window.XMLHttpRequest) {
     xmlhttp=new XMLHttpRequest();
  } else if (window.ActiveXObject) {
     xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
   }
   if (xmlhttp == null) {
      alert("Your browser does not support XMLHTTP.");
   }
   return xmlhttp;
}
Sidharth Panwar
@Sidharth thanks Q so much this source code is useful for me.
iSearch
@In Silico if u could not help don complain
iSearch