mirror of
https://gitlab.com/80486DX2-66/gists
synced 2024-12-24 04:39:51 +05:30
countLettersInTextFile.d: use argv[1]
instead of "file.txt"
This commit is contained in:
parent
c8e2aa3308
commit
4a81d7cd47
@ -4,9 +4,9 @@ import std.ascii : isAlpha, isWhite;
|
||||
import std.file : read;
|
||||
import std.stdio : writefln;
|
||||
|
||||
void main()
|
||||
void main(string[] argv)
|
||||
{
|
||||
auto fileContent = cast(string)read("file.txt");
|
||||
auto fileContent = cast(string)read(argv[1]);
|
||||
auto totalLetters =
|
||||
count(filter!(a => isAlpha(a) || isWhite(a))(fileContent));
|
||||
auto percentage = (totalLetters * 100) / cast(double)fileContent.length;
|
||||
|
Loading…
Reference in New Issue
Block a user