feature/add-strings-package#10
Merged
Merged
Conversation
Add pkg/ustrings implementing various UTF-8-aware string utilities (Capitalize, ToCamelCase/ToSnakeCase/ToKebabCase, PadLeft/PadRight, Truncate, EllipsisMiddle, Reverse, RemoveWhitespace, SplitAndTrim, JoinNonEmpty, DefaultIfEmpty) plus internal helpers (splitWords, padding/boundary logic). Also add stringify.go providing Stringify with Options to format primitives, slices, arrays, maps, structs and pointers (custom base/format/precision and nil representations). Include comprehensive tests for operations and stringify behavior.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Motivation
We were missing a shared, well-tested set of string utilities, which led to duplicated logic and inconsistent string handling across the codebase. Common operations like case conversion, padding, truncation, and safe stringification were being reimplemented ad‑hoc or avoided altogether.
What this improves
This PR introduces a dedicated
ustringspackage that centralizes frequently needed string operations and a flexibleStringifyhelper for predictable, readable output across primitive types, collections, and structs. The utilities are UTF‑8–safe, cover common edge cases, and come with comprehensive tests, making them reliable building blocks for future features.Additionally, the Docker build is aligned to compile the actual application entry point (
main.go), ensuring the container reflects how the project is meant to be built and run.Overall, this improves consistency, reduces duplication, and makes string handling safer and easier throughout the project.