https://github.com/moderocky/mapformat
A resource for formatting a string with a key <-> value map of inputs.
https://github.com/moderocky/mapformat
Last synced: 9 months ago
JSON representation
A resource for formatting a string with a key <-> value map of inputs.
- Host: GitHub
- URL: https://github.com/moderocky/mapformat
- Owner: Moderocky
- License: mit
- Created: 2023-07-17T08:18:30.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-07-17T08:24:56.000Z (almost 3 years ago)
- Last Synced: 2025-06-02T05:05:19.055Z (about 1 year ago)
- Language: Java
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Map Format
=====
### Description
A resource for formatting a string with a key <-> value map of inputs.
### Motivation
Java's built-in string format supports (very limited) inputs of strings or objects.
There are other libraries for formatting using a key but these (e.g. Sun Microsystems's 'MapFormat') are usually very
slow, not particularly good at identifying what's going on, or only support one limited key format.
I made this as a tiny, no-regex alternative.
The formatting is done in two passes: the first chops the string up into chunks of literal text and tokens to be read
from the map, and the second rebuilds the string by asking for the values from the map and inserting them into the
string builder.