32 lines
1.2 KiB
Markdown
Raw Normal View History

2021-01-29 12:31:58 +01:00
[![Arduino CI](https://github.com/RobTillaart/PrintSize/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/PrintSize/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/release/RobTillaart/PrintSize.svg?maxAge=3600)](https://github.com/RobTillaart/PrintSize/releases)
2020-02-19 10:38:09 +01:00
# PrintSize
2020-11-27 11:28:57 +01:00
Arduino library to determine the length of print statements
2021-01-29 12:31:58 +01:00
## Description
2020-11-27 11:28:57 +01:00
2020-02-19 10:38:09 +01:00
PrintSize is a minimal library to determine the length of a variable when printed.
2020-11-27 11:28:57 +01:00
This includes printing of floats, integers in decimal or hex notation.
Works for **print()**, **println()** and if supported **printf()** e.g. ESP32.
2020-02-19 10:38:09 +01:00
2020-11-27 11:28:57 +01:00
Finally since **0.2.0** it has a total counter to add up the characters "printed" since
the last **reset()** call. (see example)
2020-02-19 10:38:09 +01:00
2021-01-29 12:31:58 +01:00
## Operational
2020-11-27 11:28:57 +01:00
Example shows the right alignment of 10 random numbers
Example shows (elementary) line fitting
2020-02-19 10:38:09 +01:00
Can be used to calculate the needed space.
2020-11-27 11:28:57 +01:00
- to properly do a right alignment e.g. for numbers or variable text
- do left alignement and overwrite previous output with just enough spaces.
2020-02-19 10:38:09 +01:00
- centering of numbers
2020-11-27 11:28:57 +01:00
- see if output will fit into a line / display