Skip to content

Add ignore-case overloads for startWith, replace, and replaceAll#28

Merged
mrMigles merged 2 commits intomasterfrom
codex/add-overloads-for-startwith-and-replace-methods
Feb 7, 2026
Merged

Add ignore-case overloads for startWith, replace, and replaceAll#28
mrMigles merged 2 commits intomasterfrom
codex/add-overloads-for-startwith-and-replace-methods

Conversation

@mrMigles
Copy link
Owner

@mrMigles mrMigles commented Feb 7, 2026

Motivation

  • Enable case-insensitive text searching and replacements from scripting by adding boolean ignoreCase overloads for startWith, replace and replaceAll so scripts can match or replace without regard to case.
  • Consolidate case-insensitive logic in helpers to avoid duplicated code for literal and regex replacements.
  • Cover the new behavior with unit tests to prevent regressions.

Description

  • Added startWith(String text, boolean ignoreCase) which uses StringUtils.startsWithIgnoreCase when ignoreCase is true and falls back to String.startsWith otherwise.
  • Added replace(..., boolean ignoreCase) and replaceAll(..., boolean ignoreCase) overloads for the existing variants (literal and Function<ScriptContext,String> parameters) and centralized helpers replaceLiteral and replaceAllRegex to implement case-insensitive behavior using StringUtils.replaceIgnoreCase and Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE respectively.
  • Updated AbstractTextAndNumberOperationsTest to assert the new startWith(..., true/false), replace(..., true/false) and replaceAll(..., true) behaviors.

Testing

  • Ran the unit test command ./mvnw -q -Dtest=AbstractTextAndNumberOperationsTest test but the run failed due to a network error while Maven wrapper attempted to download Maven (Network is unreachable).
  • No other automated test runs completed in this environment due to the same network restriction.

Codex Task

@mrMigles mrMigles merged commit 8c9b75f into master Feb 7, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments