Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string findGUID(in string s)
- {
- string guid;
- if (auto ss = s.find(`<div id=`)) {
- if (ss.length < 9)
- return null;
- ss = ss[9..$];
- auto end = ss.indexOfAny(`'"`);
- if (end >= 0)
- guid = ss[0..end];
- }
- return guid;
- }
- unittest {
- assert(!findGUID(null));
- assert(!findGUID("asdasfasw"));
- assert("9527d19b" == findGUID(`<div id="9527d19b">#Text`));
- assert("9527d19b" == findGUID(`<div id='9527d19b'>#Text`));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement