GithubHelp home page GithubHelp logo

ccwc's Introduction

Word Count Tool

Write Your Own wc Tool 1st challenge in the Coding Challenges by John Crickett:

Steps

While John's site has details on what to do, I want to keep a log on my approach. Link: https://codingchallenges.fyi/challenges/challenge-wc/

Step 0

IDE - VSCode

  • This is alredy installed on my machine at the time of the project.

Language - Go

  • I do not know Go but have been wanting to try it out for a long time now.

Step 1

What should be done?

  • Read the number of bytes in a file
  • Output the number of bytes in the file
  • Add a "-c" CLI option
  • Read the input from the CLI ("test.txt")

What did I learn?

  • Assignment operator, for loop, packages, opening/closing files in Go
  • CLI arguments
  • CLI flags

Step 2

What should be done?

  • Add a "-l" CLI option
  • Output the number of lines in the file

What did I learn?

  • How to use bufio to scan a file line by line

Step 3

What should be done?

  • Add a "-w" CLI option
  • Output the number of words in the file

What did I learn?

  • ScanWords in bufio can be used to read a file word by word

Step 4

What should be done?

  • Add a "-m" CLI option
  • Output the number of characters in the file

What did I learn?

  • ScanRunes in bufio can be used to read a file character by character

Step 5

What should be done?

  • Support the default option ("-l", "-w", "-c")

What did I learn?

  • Setting the default, no-option version

ccwc's People

Contributors

vinnyxp avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.