asan13

Untitled

Jul 26th, 2017
603
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. string findGUID(in string s)
  2. {
  3.     string guid;
  4.     if (auto ss = s.find(`<div id=`)) {
  5.         if (ss.length < 9)
  6.             return null;
  7.  
  8.         ss = ss[9..$];
  9.  
  10.         auto end = ss.indexOfAny(`'"`);
  11.         if (end >= 0)
  12.             guid = ss[0..end];
  13.     }
  14.  
  15.     return guid;
  16. }
  17.  
  18. unittest {
  19.     assert(!findGUID(null));
  20.     assert(!findGUID("asdasfasw"));
  21.     assert("9527d19b" == findGUID(`<div id="9527d19b">#Text`));
  22.     assert("9527d19b" == findGUID(`<div id='9527d19b'>#Text`));
  23. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×