Jump to content

Template talk:Trim

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia
Latest comment: 1 month ago by Chrisahn in topic Performance

Protection

[edit]

semi-protect. This could become a victim of vandlism. Jaymac407 21:17, 15 April 2007 (UTC)Reply

In the future, this belongs at Wikipedia:Requests for page protection. Cbrown1023 talk 21:32, 15 April 2007 (UTC)Reply
Declined There has been no vandalism thus far and it does not qualify as a Wikipedia:High-risk templates. Cbrown1023 talk 21:33, 15 April 2007 (UTC)Reply

Leading list markers result in a newline

[edit]

Input:

x{{Trim|# test}}x

Expected output:

x# testx

Received output:

x
# testx

--Larivact (talk) 16:44, 13 August 2018 (UTC)Reply

@Larivact: This is normal for all templates. See Help:Template#Problems and workarounds, first bullet. --Redrose64 🌹 (talk) 20:52, 13 August 2018 (UTC)Reply

Remove unused "x" parameter

[edit]

Hello, this template currently supports "x" as an alternative name for the parameter (refs 668935791). Though, this alternative name isn't used at all on the wiki (nor documented).

You can check it by yourself:

And the redirects:

The results are actually some <nowiki>'ed code examples, and a few false positives (the above searches are deliberately broad). The only change I had to make: 1117988946 (and 1117988966).

Removing this parameter would be a minor optimization, but multiplied by the 1705162 transclusions it may be interesting ;-)

Od1n (talk) 16:45, 24 October 2022 (UTC)Reply

I'm just asking to replace {{{x|{{{1|}}}}}} with {{{1|}}}. I demonstrated above the "x" parameter name isn't used anywhere. Od1n (talk) 23:02, 24 October 2022 (UTC)Reply
OK, looks like that came over as a result of a merge in from the Template:Strip whitespace redirect. @Plastikspork: any special notes on that (c.f. Wikipedia:Templates_for_discussion/Log/2015_June_19#Template:Strip_whitespace)? — xaosflux Talk 10:19, 25 October 2022 (UTC)Reply

 Done. I am convinced that this parameter is not being used anywhere, although removing it was of very low priority!  Martin (MSGJ · talk) 14:02, 26 October 2022 (UTC)Reply

IP's trim request

[edit]

How do I turn "text text text" into "texttexttext"? --16:11, 22 September 2012 (UTC) — Preceding unsigned comment added by 209.141.35.164 (talk)


"Template:Cut" listed at Redirects for discussion

[edit]

An editor has identified a potential problem with the redirect Template:Cut and has thus listed it for discussion. This discussion will occur at Wikipedia:Redirects for discussion/Log/2022 November 27#Template:Cut until a consensus is reached, and readers of this page are welcome to contribute to the discussion. User:GKFXtalk 21:16, 27 November 2022 (UTC)Reply

Protected edit request on 1 June 2026

[edit]

More ministers are added and thus this article needs to be updated Sourish _ Paul (talk) 10:17, 1 June 2026 (UTC)Reply

Not done for now: Did you mean to edit Template:External affairs ministers of India or Template:Union ministries of India? I don't think this is the correct template. ASUKITE 14:15, 1 June 2026 (UTC)Reply
I want to edit West Bengal Government because ministers are added to this Government. Sourish _ Paul (talk) 15:16, 1 June 2026 (UTC)Reply
@Sourish Paul Shyamnagar India:  Not done: this is the talk page for discussing improvements to the template {{Trim}}. Please make your request at the talk page for the article concerned. --Redrose64 🌹 (talk) 07:49, 2 June 2026 (UTC)Reply

Performance

[edit]

I created a wiki page that consisted of 10,000 invocations to trim a string, reloaded (purged) the page a couple of times and looked at the CPU time usage in the generated HTML source code. Three different ways to trim 10,000 strings:

  • {{trim| foo }}: roughly between 0.5 seconds and 1.0 seconds
  • {{#invoke|String2|trim| foo }}: between 2.5 seconds and 5.0 seconds
  • {{#if:1| foo }}: between 0.1 seconds and 0.25 seconds

Probably doesn't matter in most cases, but if you really care about performance, you should probably use the {{#if:1| foo }} trick. — Chrisahn (talk) 09:43, 4 July 2026 (UTC)Reply