Wikisage, de vrije encyclopedie van de tweede generatie, is digitaal erfgoed

Wikisage is op 1 na de grootste internet-encyclopedie in het Nederlands. Iedereen kan de hier verzamelde kennis gratis gebruiken, zonder storende advertenties. De Koninklijke Bibliotheek van Nederland heeft Wikisage in 2018 aangemerkt als digitaal erfgoed.

  • Wilt u meehelpen om Wikisage te laten groeien? Maak dan een account aan. U bent van harte welkom. Zie: Portaal:Gebruikers.
  • Bent u blij met Wikisage, of wilt u juist meer? Dan stellen we een bescheiden donatie om de kosten te bestrijden zeer op prijs. Zie: Portaal:Donaties.
rel=nofollow

Sjabloon:Str index: verschil tussen versies

Uit Wikisage
Naar navigatie springen Naar zoeken springen
(http://en.wikipedia.org/w/index.php?title=Template:Str_index&oldid=434795244)
 
(CAT)
 
(Een tussenliggende versie door een andere gebruiker niet weergegeven)
Regel 4: Regel 4:
| 3 = {{{{{|safesubst:}}}str index/logic |nocategory={{{nocategory|}}} |*{{{{{|safesubst:}}}str left |nocategory={{{nocategory|}}} |{{{1|}}}|{{{2|0}}}}}*|{{{{{|safesubst:}}}str left |nocategory={{{nocategory|}}} |{{{1|}}}|{{{{{|safesubst:}}}#expr:{{{2|0}}}-1}}}}}}
| 3 = {{{{{|safesubst:}}}str index/logic |nocategory={{{nocategory|}}} |*{{{{{|safesubst:}}}str left |nocategory={{{nocategory|}}} |{{{1|}}}|{{{2|0}}}}}*|{{{{{|safesubst:}}}str left |nocategory={{{nocategory|}}} |{{{1|}}}|{{{{{|safesubst:}}}#expr:{{{2|0}}}-1}}}}}}
| 4 = {{FormattingError |nocategory={{{nocategory|}}} |((str index)): String is not long enough.}}
| 4 = {{FormattingError |nocategory={{{nocategory|}}} |((str index)): String is not long enough.}}
}}</includeonly><noinclude>{{sjablooninfo|1=
}}</includeonly><noinclude>{{sjablooninfo|1= &nbsp;
=== Usage ===
=== Usage ===
<nowiki>{{</nowiki>str index{{!}}''text''{{!}}''number''<nowiki>}}</nowiki> = Returns the ''number''-th character of ''text''. Base 1: the first character is numbered 1, and so on.
<nowiki>{{</nowiki>str index{{!}}''text''{{!}}''number''<nowiki>}}</nowiki> = Returns the ''number''-th character of ''text''. Base 1: the first character is numbered 1, and so on.
Regel 17: Regel 17:
* <code><nowiki>{{str len|{{str index|a b|2}}}}}}</nowiki></code> → {{str len|{{str index|a b|2}}}} (because the return is <code>&amp;#32;</code> rather than a space character.)
* <code><nowiki>{{str len|{{str index|a b|2}}}}}}</nowiki></code> → {{str len|{{str index|a b|2}}}} (because the return is <code>&amp;#32;</code> rather than a space character.)


}}</noinclude>
}}
[[Categorie:Sjablonen scripting]]
[[Categorie:Nog te vertalen sjablonen]]
</noinclude>

Huidige versie van 15 jul 2012 om 14:22

De sjabloonbeschrijving hieronder wordt niet afgebeeld wanneer de sjabloon wordt geplaatst.

 

Usage

{{str index|text|number}} = Returns the number-th character of text. Base 1: the first character is numbered 1, and so on.

Only supports a limited character set. Returns an error on unknown characters. Returns &#32; for a blank space.

The character set is A-Z, a-z, 0-9, space and !@#$%^&*().,<>:;[]'"?/\{}~`=-|+_♣♦♥♠. (Obviously | and = will have to have been input as {{!}} and {{=}}.)

Examples

  • {{str index|0123456789ABCDEF|15}} → E
  • {{str index|0123456789ABCDEF|18}}((str index)): String is not long enough.
  • {{str len|{{str index|a b|2}}}}}} → 5 (because the return is &#32; rather than a space character.)