README.md (661B)
1 DFortune 2 =========== 3 A small and somewhat primitive library to parse unix fortunecookie files. 4 5 It parses the file and then provides a random access range to the cookies, 6 which get red lazily. 7 8 Encoding 9 -------- 10 The encoding isn't considered at all. The library-user has to know in what 11 encoding the fortunefile is saved, and handle it accordingly. 12 13 14 Example 15 ------- 16 The library should be fairly self-explanatory. 17 18 ```D 19 Fortune f; 20 f.open("/path/to/file"); 21 scope(exit)f.close(); 22 23 writeln(f.strings.joiner("\n")); 24 writeln(f.range.filter!(a=>a.size>300).map!(a=>f.read(a)).joiner("\n")); 25 ``` 26 27 Note that both `/path/to/file` and `/path/to/file.dat` have to exist.