The range of multiple nonempty values. Note: Returned range unescapes ';' character automatically.
1 assert(DesktopFile.splitValues("").empty); 2 assert(DesktopFile.splitValues(";").empty); 3 assert(DesktopFile.splitValues(";;;").empty); 4 assert(equal(DesktopFile.splitValues("Application;Utility;FileManager;"), ["Application", "Utility", "FileManager"])); 5 assert(equal(DesktopFile.splitValues("I\\;Me;\\;You\\;We\\;"), ["I;Me", ";You;We;"])); 6 7 auto values = DesktopFile.splitValues("Application;Utility;FileManager;"); 8 assert(values.front == "Application"); 9 values.popFront(); 10 assert(equal(values, ["Utility", "FileManager"])); 11 auto saved = values.save; 12 values.popFront(); 13 assert(equal(values, ["FileManager"])); 14 assert(equal(saved, ["Utility", "FileManager"]));
Some keys can have multiple values, separated by semicolon. This function helps to parse such kind of strings into the range.