Last modified: 2011-03-13 18:05:04 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T18197, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 16197 - add {{#substr:}}, {{#head:}}, {{#tail:}}, {{#len:}} function
add {{#substr:}}, {{#head:}}, {{#tail:}}, {{#len:}} function
Status: RESOLVED WONTFIX
Product: MediaWiki extensions
Classification: Unclassified
ParserFunctions (Other open bugs)
unspecified
All All
: Lowest enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: easy
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-10-31 07:20 UTC by Anon Sricharoenchai
Modified: 2011-03-13 18:05 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Anon Sricharoenchai 2008-10-31 07:20:56 UTC
{{ #substr: str | pos | len }} == {{ #mid: str | pos | len }}
{{ #substr: abcdef | 1 | 3 }} --> bcd
{{ #substr: abcdef | 1 }} --> bcdef
{{ #substr: abcdef | 0 | 3 }} --> abc
* The "pos" and "len" can also be negative, and have the same behavior as php's substr()

{{ #head: str | len }} == {{ #left | len }} == {{ #substr: str | 0 | len }}
{{ #tail: str | len }} == {{ #right | len }} == {{ #substr: str | -len }}

If you need patch, I'm going to implement it.
Comment 1 Anon Sricharoenchai 2008-10-31 07:32:41 UTC
Add one more common function,
* {{ #len: str }} == {{ #strlen: str }} == {{ #length: str }}
Comment 2 Matt Johnston 2008-10-31 07:50:10 UTC
strlin and substr already exist in StringFunctions extension. I'm not sure about head and tail, but they should be easily acheivable with that extension as well.
Comment 3 Anon Sricharoenchai 2009-02-25 08:24:54 UTC
WONFIX: see comment #2

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links