Skip to content

Conversation

henryqwe
Copy link

@henryqwe henryqwe commented Jun 30, 2025

Enhanced String.replaceWithArgs to support non-positional format specifiers (%s, %d) when only one argument is provided

CMP-8385

Testing

Unit tests added

@henryqwe henryqwe force-pushed the resources-single-parameter branch from bcaba8a to b0ce03d Compare June 30, 2025 16:37
…ecifiers (%s, %d) when only one argument is provided
@henryqwe henryqwe force-pushed the resources-single-parameter branch from b0ce03d to 3ea093f Compare July 1, 2025 08:20
@MatkovIvan MatkovIvan requested a review from terrakok September 15, 2025 16:07
)
}
}
args[index]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a placeholder index exceeds the number of provided args (e.g. %3$s with only 2 args), this will throw IndexOutOfBoundsException. Would it be worth catching that and throwing a clearer error (similar to MissingFormatArgumentException) so devs can quickly see which placeholder is invalid?

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.

2 participants