Skip to content

Improved Formatted Reading#23

Merged
brightprogrammer merged 1 commit intomasterfrom
improved_fmt_read
Sep 2, 2025
Merged

Improved Formatted Reading#23
brightprogrammer merged 1 commit intomasterfrom
improved_fmt_read

Conversation

@brightprogrammer
Copy link
Copy Markdown
Owner

Formatted reading now better detects the length of content to be parsed. Before attempting to read value at a placeholder, it'll first find the maximum possible length of reading that. This works by the following logic :

  • If there are two placeholders, and nothing is between them, the first placeholder can read as much as possible, and second placeholder may get empty!
  • If there are two placeholders, and there's something in between them, first placeholder can only read up until the content between the space between the placeholders. So for {} {}, first placeholder can only read up until first space. Then rest becomes possible read length of second placeholder.
  • If there is only one placeholder, it'll get to read the whole string. It may or may not read it completely.

This new logic makes fmt reading much more helpful and easy to work with. This means more string format checking when parsing input. Pair this with the new format specifier {s} in last PR #22, it makes it easier to parse strings, and formatted strings!

@brightprogrammer brightprogrammer merged commit 5e027a6 into master Sep 2, 2025
9 checks passed
@brightprogrammer brightprogrammer deleted the improved_fmt_read branch September 2, 2025 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant