Template:Leading-number/doc

From Pittsburgh Streets

The {{leading-number}} template extracts a leading number from a string.

Usage examples and test cases

  • {{leading-number}}
  • {{leading-number|}}
  • {{leading-number|1}} → 1
  • {{leading-number|123}} → 123
  • {{leading-number|1a}} → 1
  • {{leading-number|1a2b}} → 1
  • {{leading-number|123abc}} → 123
  • {{leading-number|1 2 3}} → 1
  • {{leading-number|abc}}
  • {{leading-number|abc123}}
  • {{leading-number|1=2}} → 2
  • {{leading-number|1=2=3}} → 2
  • {{leading-number|5½}} → 5