Content deleted Content added
→Deleted functions: If you care about what this module used to do, then you can look at the history |
→matchAny: add hyphen2dash |
||
Line 126:
<code>{{((}}#invoke:String2|matchAny|123|abc|source=abc 124}}</code> returns 2.
=== hyphen2dash ===
Extracted hyphen_to_dash() function from [[Special:Permalink/1017669505|Module:Citation/CS1]].
Converts a hyphen to a dash under certain conditions. The hyphen must separate like items; unlike items are returned unmodified. These forms are modified:
* letter - letter (A - B)
* digit - digit (4-5)
* digit separator digit - digit separator digit (4.1-4.5 or 4-1-4-5)
* letterdigit - letterdigit (A1-A5) (an optional separator between letter and digit is supported – a.1-a.5 or a-1-a-5)
* digitletter - digitletter (5a - 5d) (an optional separator between letter and digit is supported – 5.a-5.d or 5-a-5-d)
Any other forms are returned unmodified.
The input string may be a comma- or semicolon-separated list.
<code><nowiki>{{</nowiki>#invoke:String2|hyphen2dash|1=1-2<nowiki>}}</nowiki></code> returns 1–2.
== Usage ==
|