]> git.llucax.com Git - personal/website.git/blob - source/blog/posts/2010/08/14-memory-allocation/split.d
Update resume with The Podcast App
[personal/website.git] / source / blog / posts / 2010 / 08 / 14-memory-allocation / split.d
1 // Written by bearophile <bearophileHUGS@lycos.com>
2 // Fount at http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=67673
3 // Sightly modified by Leandro Lucarella <llucax@gmail.com>
4 // (removed timings)
5
6 import tango.io.device.File: File;
7 import tango.text.Util: delimit;
8 import tango.util.Convert: to;
9
10 int main(char[][] args) {
11         if (args.length < 2)
12                 return 1;
13         auto txt = cast(byte[]) File.get(args[1]);
14         auto n = (args.length > 2) ? to!(uint)(args[2]) : 1;
15         if (n < 1)
16                 n = 1;
17         while (--n)
18                 txt ~= txt;
19         auto words = delimit!(byte)(txt, cast(byte[]) " \t\n\r");
20         return !words.length;
21 }
22