Templat:Trim leading: Perbedaan antara revisi
dw>Bennylin k (Melindungi "Templat:Trim leading": Templat berisiko tinggi ([Sunting=Hanya untuk pengurus] (selamanya) [Pindahkan=Hanya untuk pengurus] (selamanya))) |
(←Membuat halaman berisi '{{#switch: 1 | {{#ifeq: {{padleft:|{{#expr: 6*{{strlen_quick|{{{2|0}}}|}} }}|{{{2|0}}} }}|{{padleft:|{{#expr: 6*{{strlen_quick|{{{2|0}}}|}} }}|{{{1|00x}}} }}| 1|0}} = {{str_right|{{{1|00x}}}|{{#expr: 6*{{strlen_quick|{{{2|0}}}|}} }} }} | {{#ifeq: {{padleft:|{{#expr: 5*{{strlen_quick|{{{2|0}}}|}} }}|{{{2|0}}} }}|{{padleft:|{{#expr: 5*{{strlen_quick|{{{2|0}}}|}} }}|{{{1|00x}}} }}| 1|0}} = {{str_right|{{{1|00x}}}|{{#expr: 5*{{strlen_quick|{{{2|0}}}|}} }} }...') |
(Tidak ada perbedaan)
|
Revisi per 26 September 2023 06.11
x
Penggunaan
{{Trim leading | <input> | <prefix> }}
Trims up to six instances of <prefix> (such as: 0 or "anti-") from the beginning of <input>. <Prefix> is set to "0" by default (for removing leading zeroes from numbers). Template will not properly work beyond the first whitespace in the input.
Pembatasan
- Up to 100 chararacters in the input string. If possible, first check length of input string using {{Str len}}. Using strings longer than 100 characters may result in the error "max index is 100 for str_sub".
- Limited set of characters.
- Snags on whitespace.
- Expensive.
Contoh
{{Trim leading |duck duck duck goose |duck}}
→ duck duck goose
{{Trim leading | duckduckduckgoose |duck}}
→ goose
{{Trim leading | 00000034 }}
→ 34
{{Trim leading | aaaaaa34| a }}
→ 34
{{Trim leading | U+0034|U+}}
→ 0034
{{Trim leading |anti-anti-neutrino |anti-}}
→ neutrino
Teknis
This template uses parser function {padleft}. It formerly called 6 subtemplates: Template:Trim leading/1, /2 ... /6, which are all functionally identical, allowing for up to six instantiations of prefix to be removed.
Lihat juga
Dokumentasi di atas ditransklusikan dari Templat:Trim leading/doc. (sunting | versi terdahulu) Penyunting dapat melakukan uji coba pada halaman bak pasir (buat | cermin) dan kasus uji (buat) templat ini. Mohon tambahkan kategori pada subhalaman /doc. Subhalaman templat ini. |