Skip to main content

mask_for_pattern

Function mask_for_pattern 

Source
pub fn mask_for_pattern(pattern: &ParsedPattern) -> String
Expand description

Build an InputMask grammar string from a parsed pattern. Each digit segment becomes the corresponding number of 9 chars; the AM/PM period segment becomes >AA (two uppercase-locked letters); literals stay as fixed separators.

Pattern → mask:

  • %Y-%m-%d9999-99-99
  • %m/%d/%Y99/99/9999
  • %H:%M:%S99:99:99
  • %I:%M %p99:99 >AA

Backslashes in the pattern’s literal positions are escaped via \\ so the InputMask parser treats them as literals (otherwise \X in a literal would consume the following char).