count-characters

Crates.iocount-characters
lib.rscount-characters
version0.1.4
created_at2025-04-26 05:23:29.167979+00
updated_at2025-05-04 03:25:20.024562+00
descriptionA simple Rust program to count characters in a string
homepagehttps://github.com/anhkhoakz/some-rust-scripts/tree/main/count-characters
repositoryhttps://github.com/anhkhoakz/some-rust-scripts/tree/main/count-characters
max_upload_size
id1649902
size12,958
Nguyễn Huỳnh Anh Khoa (anhkhoakz)

documentation

README

Count Characters

Table of Contents

Crates.io Version Crates.io Total Downloads Crates.io Size Crates.io License

About

Count Characters is a simple CLI tool written in Rust that counts the number of characters in a given input, including support for reading from files. It trims leading and trailing blank lines and is designed for quick, efficient use in the terminal.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

  • Rust (version 1.86.0 or later)
  • Cargo (comes with Rust)

Installing

Clone the repository:

git clone https://github.com/anhkhoakz/some-rust-scripts/
cd some-rust-scripts
cd count-characters

Install the binary (optional, requires sudo):

just install
# or from crates.io:
cargo install count-characters

To uninstall:

just uninstall
# or from crates.io:
cargo uninstall count-characters

Usage

You can run the tool with:

./target/release/count-characters

Or, if installed:

count-characters

Paste your text, then press Ctrl-D (on Mac/Linux) or Ctrl-Z (on Windows) to finish input. The tool will output the number of characters in your input (excluding leading/trailing blank lines).

Example:

$ count-characters
Paste your text, then press Ctrl-D (on Mac/Linux) or Ctrl-Z (on Windows) to finish:
Hello, world!

Input contains 13 characters.
$ count-characters /path/to/file.txt
Input contains 42 characters.

License

This project is licensed under the GNU General Public License version 2 - see the LICENSE file for details.

Commit count: 69

cargo fmt