In NdnProtocolInfo.jsm, added splitUri, and use in ndnProtocolService.js and ndnToolbar.js.
diff --git a/js/ndnProtocol/modules/NdnProtocolInfo.jsm b/js/ndnProtocol/modules/NdnProtocolInfo.jsm
index a2fb10d..bf8bf55 100644
--- a/js/ndnProtocol/modules/NdnProtocolInfo.jsm
+++ b/js/ndnProtocol/modules/NdnProtocolInfo.jsm
@@ -3,7 +3,7 @@
  * See COPYING for copyright and distribution information.
  */
 
-var EXPORTED_SYMBOLS = ["addNdnHubChangedListener", "setConnectedNdnHub"];
+var EXPORTED_SYMBOLS = ["addNdnHubChangedListener", "setConnectedNdnHub", "splitUri"];
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
@@ -51,4 +51,32 @@
             // Ignore error from the listener.
         }
     }
+}
+
+/*
+ * Split the URI spec and return an object with protocol (including ':'), name, 
+ *   search (including '?') and hash value (including '#').  
+ * All result strings are trimmed.  This does not unescape the name.
+ * The name may include a host and port.  
+ */
+function splitUri(spec) {
+    spec = spec.trim();
+    var result = {};
+    var preHash = spec.split('#', 1)[0];
+    result.hash = spec.substr(preHash.length).trim();
+    var preSearch = preHash.split('?', 1)[0];
+    result.search = preHash.substr(preSearch.length).trim();
+    
+    preSearch = preSearch.trim();
+    var colonIndex = preSearch.indexOf(':');
+    if (colonIndex >= 0) {
+        result.protocol = preSearch.substr(0, colonIndex + 1).trim();
+        result.name = preSearch.substr(colonIndex + 1).trim();    
+    }
+    else {
+        result.protocol = "";
+        result.name = preSearch;
+    }
+    
+    return result;
 }
\ No newline at end of file