Anonymous
Not logged in
Talk
Contributions
Create account
Log in
Search
Editing
Template:Trim brackets/doc
From MEpedia, a crowd-sourced encyclopedia of ME and CFS science and history
Namespaces
Template
Discussion
More
More
Page actions
Read
Edit source
History
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Documentation subpage}} <!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --> {{lua|Module:String}} This template trims leading and trailing square brackets and whitespace from a string. This is similar to {{tl|delink}}, but it won't remove brackets from the middle of the string. The string should be passed as the first unnamed parameter or using {{para|1}} if your string contains any <code>=</code> signs. You may [[Help:Substitution|substitute]] this template - that is, if used as {{tlxs|trim brackets}}, the resulting wikicode is "clean". == Usage == {{tlx|trim brackets|''text''}} = ''text'' with any leading or trailing square brackets removed (as long as ''text'' doesn't contain any <code>=</code> signs). {{tlx|1=trim brackets|2=1=''text''}} = ''text'' with any leading or trailing square brackets removed. == Example == *"{{tlx|trim brackets|<nowiki>1= [[abc]] </nowiki>}}" produces "{{trim brackets|1= [[abc]] }}". *"{{tlx|trim brackets|<nowiki>1= [[abc]], [[def]], and [[ghi]] </nowiki>}}" produces "{{trim brackets|1= [[abc]], [[def]], and [[ghi]] }}"<br />("{{tlx|delink|<nowiki>1= [[abc]], [[def]], and [[ghi]] </nowiki>}}" produces "{{delink|1= [[abc]], [[def]], and [[ghi]] }}"). == Template data == {{TemplateDataHeader}} <templatedata> { "description": "The template trims leading and trailing square brackets from a string.", "params": { "1": { "label": "String", "description": "The string to be trimmed", "type": "string", "required": true } } } </templatedata> == See also == * {{tl|delink}}, which does nearly the exact same thing, but also removes balanced pairs of square brackets that aren't leading and trailing and has additional options. * {{tl|trim}} <includeonly> <!-- CATEGORIES AND INTERWIKIS HERE, THANKS --> [[Category:String manipulation templates]] </includeonly>
Summary:
Please make sure your edits are consistent with
MEpedia's guidelines
.
By saving changes, you agree to the
Terms of use
, and you irrevocably agree to release your contribution under the
CC BY-SA 3.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Delink
(
edit
)
Template:Documentation subpage
(
edit
)
Template:Lua
(
edit
)
Template:Mbox
(
edit
)
Template:Para
(
edit
)
Template:Strong
(
edit
)
Template:TemplateDataHeader
(
edit
)
Template:TemplateData header
(
edit
)
Template:Template error report
(
view source
) (protected)
Template:Template link expanded
(
edit
)
Template:Terminate sentence
(
edit
)
Template:Tl
(
edit
)
Template:Tlx
(
edit
)
Template:Tlxs
(
edit
)
Template:Trim brackets
(
edit
)
Template:Yesno
(
edit
)
Template:Yesno-no
(
edit
)
Module:Arguments
(
edit
)
Module:Delink
(
edit
)
Module:List
(
edit
)
Module:Lua banner
(
edit
)
Module:Message box
(
edit
)
Module:Message box/configuration
(
edit
)
Module:No globals
(
edit
)
Module:String
(
edit
)
Module:TableTools
(
edit
)
Module:Template link general
(
edit
)
Module:Text
(
edit
)
Module:Yesno
(
edit
)
Navigation
Navigation
Skip to content
Main page
Browse
Become an editor
Random page
Popular pages
Abbreviations
Glossary
About MEpedia
Links for editors
Contents
Guidelines
Recent changes
Pages in need
Search
Help
Wiki tools
Wiki tools
Special pages
Page tools
Page tools
User page tools
More
What links here
Related changes
Page information
Page logs