展示HN:我重写了printf – 现在强大了10倍(v1.3)
经过几个月的开发,我很高兴地发布 uprintf v1.3——一个终极的跨平台 printf 替代方案,适用于从裸机微控制器到现代操作系统的各种环境。
v1.3 的新功能包括:
- 模板系统 - 现在支持像现代模板引擎一样的 {{variable}} 替换
- 多输出流 - 同时广播到多个目标(UART、文件、网络)
- 字符串构建器 - 动态字符串构建,具有效率的内存管理
- 文本转换 - 内置大写、小写、首字母大写、反转和 ROT13 转换
- 高级格式化 - 文本对齐、换行和基于模式的格式化
- 事件系统 - 钩住输出流以进行监控和处理
- 流处理器 - 实时字符转换管道
- 状态机 - 轻量级状态管理,适用于复杂工作流
而且它仍然是:
- 零依赖
- 仅头文件
- 完全可移植
- MIT 许可证
非常适合嵌入式系统、命令行工具以及任何需要强大格式化而不增加负担的场合。
GitHub: [https://github.com/Ferki-git-creator/Uprintf](https://github.com/Ferki-git-creator/Uprintf)
查看原文
After months of development, I'm excited to release uprintf v1.3 - the ultimate platform-independent printf replacement that works everywhere from bare-metal microcontrollers to modern OSes.<p>What's new in v1.3:<p>-Template System - Now with {{variable}} substitution like modern template engines
-Multi-Output Streaming - Broadcast to multiple destinations simultaneously (UART, files, network) -String Builder - Dynamic string building with efficient memory management
-Text Transformation - Built-in uppercase, lowercase, capitalize, reverse, and ROT13 transforms
-Advanced Formatting - Text alignment, wrapping, and pattern-based formatting
-Event System - Hook into output streams for monitoring and processing -Stream Processors - Real-time character transformation pipelines
-State Machine - Lightweight state management for complex workflows<p>And it's still:
-Zero dependencies
-Header-only
-Fully portable
-MIT licensed<p>Perfect for embedded systems, CLI tools, and anywhere you need powerful formatting without bloat.<p>GitHub: <a href="https://github.com/Ferki-git-creator/Uprintf" rel="nofollow">https://github.com/Ferki-git-creator/Uprintf</a>