Class FindReplaceHelper

java.lang.Object
io.keikai.range.impl.FindReplaceHelper

public class FindReplaceHelper extends Object
Helper class for find and replace operations on a spreadsheet.

Implements cell iteration, text extraction, and pattern matching according to the options specified in FindOptions.

Since:
7.0.0
  • Constructor Details

    • FindReplaceHelper

      public FindReplaceHelper()
  • Method Details

    • find

      public CellRegion find(SSheet sheet, String searchText, FindOptions options, int startRow, int startCol)
      Finds the next cell matching the search text, starting after the given position.
      Parameters:
      sheet - the sheet to search in
      searchText - the text to find
      options - the find options
      startRow - the row to start searching from (inclusive)
      startCol - the column to start searching from (inclusive, search starts at next cell)
      Returns:
      the matching CellRegion, or null if not found
    • findAll

      public List<CellRegion> findAll(SSheet sheet, String searchText, FindOptions options)
      Finds all cells matching the search text in the given sheet.
      Parameters:
      sheet - the sheet to search in
      searchText - the text to find
      options - the find options
      Returns:
      a list of matching CellRegion objects (never null)
    • replace

      public int replace(SSheet sheet, String searchText, String replacement, FindOptions options)
      Replaces all occurrences of the search text with the replacement in the given sheet.
      Parameters:
      sheet - the sheet to search in
      searchText - the text to find
      replacement - the replacement text
      options - the find options
      Returns:
      the number of replacements made