Doi
A digital object identifier (the DOI Handbook), with no resolver before it and ASCII letters in lower case: 10.1038/nphys1170.
Software; not ordered; since Jadpo 0.1.0.
Make one
Build one from its text, Doi("10.1000/182"), which checks it: text that isn't one breaks format.
text.parse(raw, as: Doi) reads one from its text; text that isn't one at all fails malformed, such as doi:10.1000/182, https://doi.org/10.1000/182 or 10.1038/NPHYS1170.
Text, JSON and storage
text.from writes its canonical text, the one form text.parse reads back. JSON sends its canonical text as a string.
| Text | JSON |
|---|---|
10.1000/182 |
"10.1000/182" |
10.1038/nphys1170 |
"10.1038/nphys1170" |
10.1002/(sici)1097-4571(199806)49:8<693::aid-asi4>3.0.co;2-o |
"10.1002/(sici)1097-4571(199806)49:8<693::aid-asi4>3.0.co;2-o" |
10.1000.10/123456 |
"10.1000.10/123456" |
It is stored in one column named for the field, of type text. 10.1002/(sici)1097-4571(199806)49:8<693::aid-asi4>3.0.co;2-o is stored as '10.1002/(sici)1097-4571(199806)49:8<693::aid-asi4>3.0.co;2-o'.
Shown to people
text.format(value, locale:) shows it to people in their locale.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
10.1000/182 |
10.1000/182 |
10.1038/nphys1170 |
10.1038/nphys1170 |
10.1002/(sici)1097-4571(199806)49:8<693::aid-asi4>3.0.co;2-o |
10.1002/(sici)1097-4571(199806)49:8<693::aid-asi4>3.0.co;2-o |
10.1000.10/123456 |
10.1000.10/123456 |
Operations
It has the contract's own operations: text.parse, text.from, text.format, json.read, json.write and ==. It isn't ordered, so < and sorting don't take it. Every standard type meets one contract says how they work.
Markdown for agents: /docs/types/type-doi.md.Built from Jadpo main at e00e61f.