EinFormatUS
The two ways a US Employer Identification Number is written: bare digits or dashed.
An EIN (Employer Identification Number) is the nine-digit tax id the IRS gives US
businesses. People write it two ways: nine bare digits, "123456789", or the usual
dashed form, "12-3456789". EinFormatUS names those layouts, and it answers two
separate questions on the EIN methods: which layout the input must arrive in, and
which shape the result comes back in.
Members
| Member | Meaning |
|---|---|
Any |
No constraint. As an input rule it accepts both layouts; as an output shape it returns the number in whichever layout it arrived in. The default input rule. |
Digits |
Nine bare digits: "123456789". |
Dashed |
The usual written form — a two-digit prefix, a hyphen, seven digits: "12-3456789". The default output shape. |
Where it is used
Only CkUS takes it. Ein takes the enum twice: format says
which layout the input must match (defaults to Any), and output says which shape
comes back (defaults to Dashed; pass Digits for storage). EinMask takes an
output parameter too — the shape it masks in; there Any keeps a valid value's own
layout and falls back to the dashed shape for the fully masked placeholder.
Quick look
using SafeCoder.CommonKit;
using SafeCoder.CommonKit.Enums;
CkUS.Ein("123456789"); // -> "12-3456789" (any layout in, dashed out — the defaults)
CkUS.Ein(
input: "12-3456789",
output: EinFormatUS.Digits
); // -> "123456789" (bare digits, ready for storage)
CkUS.Ein(
input: "12-3456789",
format: EinFormatUS.Digits
); // -> "" (the input had to be bare digits, so the dashes reject it)