SHARE
TWEET

Untitled

a guest Dec 18th, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Var a= {"fmrd":"pmc","bdr": "kmn"};
  2.    
  3. var a= "{"fmrd":"pmc","bdr": "kmn" }";
  4. var jsonData = JSON.parse(a);
  5.    
  6. var a= '{"fmrd":"pmc","bdr": "kmn"}';
  7. JSON.parse(a);
  8.    
  9. a= ""fmrd":"pmc""bdr": "kmn"";
  10.    
  11. a= "{'fmrd':'pmc','bdr': 'kmn'}";
  12.    
  13. var a= [ "fmrd":"pmc","bdr": "kmn"];
  14.  
  15. var obj = {};
  16.  
  17. for (var i = 0; i < x.length; i++) {
  18.  
  19.     var split = x[i].split(':');
  20.  
  21.     obj[split[0].trim()] = split[1].trim();
  22. }
  23.    
  24. String test = "an:example::using:map::where:key::value:store";
  25.         Map<String, String> m = new HashMap<String, String>();
  26.         // split on ':' and on '::'
  27.         String[] parts = test.split("::?");
  28.  
  29.         for (int i = 0; i < parts.length; i += 2) {
  30.             m.put(parts[i], parts[i + 1]);
  31.         }
  32.  
  33.         for (String s : m.keySet()) {
  34.             System.out.println(s + " is " + map.get(s));
  35.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top