Skip to main content

parse_page_range

Function parse_page_range 

Source
pub fn parse_page_range(
    range_str: &str,
    total_pages: usize,
) -> Option<HashSet<usize>>
Expand description

Parse a page range string into a set of 1-based page numbers.

Supports formats:

  • "3" — single page
  • "1-5" — range (inclusive)
  • "1,3,5" — comma-separated
  • "1-3,7,10-12" — mixed

Returns None if the string is empty or invalid.