Jump to content
Main menu
Main menu
move to sidebar
hide
Discord
Discord
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Guidelines & Policy
Community Rules
Wiki Staff
Manual of Style
Syntax and Formatting
Images Policy
Editing Guides
Language Guides
Recent changes
rc-skeleton
Characters
Anima
Eidos
NPCs
More...
The World
Planes
Nexus
Novarchs
Sovereigns
Sundering
Game Systems
Aspect
Trait
Nexus Battle
Abilities
Loading Screens
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Editing
Template
:
Array/doc
Template
Discussion
English
Read
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit source
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Once you make an edit, a temporary account will be created for you.
Learn more
.
Log in
or
create an account
to continue receiving notifications after this account expires, and to access other features.
Anti-spam check. Do
not
fill this in!
{{Documentation/Header}} {{High Risk}} {{Lua|Array}} Divides a string into a formatted list of substrings. ==Syntax== '''Required Parameters:''' *'''1''': arrayString - the input string, each item expected to be separated by the <code>separator</code> parameter. *'''2''': separator - the character or substring to split on. ** <code>{newline}</code> is replaced with a newline. ** <code>{space}</code> is replaced with a space. '''Format Parameters:'''<br /> If format is not specified, then the default format is <code>{item}</code>. *'''3''': format - the resulting format of each substring. ** <code>{item}</code> is replaced with the item. ** <code>{itemLink}</code> is replaced with the item as a link. ** <code>{itemLinkSafe}</code> is replaced with the item as a link if the page exists otherwise is replaced with the item as text. ** <code>{index}</code> is replaced with the index. ** <code>{newline}</code> is replaced with a newline. ** <code>{space}</code> is replaced with a space. Useful if you need a leading/trailing space. You could also use <code>&nbsp;</code> * '''format<index>''': custom format to override the <code>format</code> param for a particular substring by its index ** Index is 1-based. For example <code>format2</code> would be the format for the second item of the array. ** supports the same tokens (like <code>{itemLink}</code>) that <code>format</code> param does. *'''noTrim''' (optional): set to 1 to not remove whitespace from items in the array. *'''template''' (optional): set to 1 to allow escaped template syntax for complex returns ** escape {{F|<nowiki>{{</nowiki>}} as: {{F|²{}} or {{F|^2{}}. ** escape {{F|<nowiki>}}</nowiki>}} as: {{F|}²}} or {{F|}^2}}. ** escape {{F|<nowiki>|</nowiki>}} as: {{F|¦}} or {{F|¹}}. '''Join Parameters:'''<br /> These three parameters are mutually exclusive (meaning you can only have one of these three): *'''4''': join (optional) - separator between each element to join. Default no separator. ** <code>{newline}</code> is replaced with a newline. ** <code>{space}</code> is replaced with a space. Useful if you need a leading/trailing space. You could also use <code>&nbsp;</code> *'''sentence''' (optional): set to 1 to format as a sentence (commas with an "and" for the last element). **'''sentence_join''' (optional): sentence join character, defaults to <code>,</code> **'''sentence_last''' (optional): sentence join last word, defaults to <code> and </code> *'''prefix''' (optional): Text added to start of result. *'''suffix''' (optional): Text added to end of result. '''Filter/Sort Parameters:'''<br /> These parameters are checked/applied in the order as shown below: *'''removeEmpty''' (optional): set to 1 to remove empty elements. *'''dedupe''' (optional): set to 1 to remove duplicate items in the array. *'''sort''' (optional): set to 1 to sort the items in the array in ascending order, -1 for descending. *'''firstItemOnly''' (optional): set to 1 to only display the first element of the array. ** You could also do <code>offsetStart=1|offsetEnd=1</code> but this is a shortcut. *'''offsetStart''' (optional): only keep elements of the array at and after this index (inclusive). *'''offsetEnd''' (optional): only keep elements of the array at and before this index (inclusive). Knowing this order, you can use these parameters to achieve various effects. Such as: <code>removeEmpty=1|offsetStart=1|offsetEnd=1</code> to get the first non-empty element of the input array string. ==Examples== ;Simple example <pre>{{Array|1,2,3,4,5|,|*''{item}''|{newline} }}</pre> {{Array|1,2,3,4,5|,|*''{item}''|{newline} }} ;Dedupe example <pre>{{Array|1,2,2,2,3,4,5|,|*''{item}''|{newline}|dedupe=1}}</pre> {{Array|1,2,2,2,3,4,5|,|*''{item}''|{newline}|dedupe=1}} ;Remove empty example <pre>{{Array|1,2,,, ,3,4,5|,|*''{item}''|{newline}|removeEmpty=1}}</pre> {{Array|1,2,,, ,3,4,5|,|*''{item}''|{newline}|removeEmpty=1}} ;Sort example <pre>{{Array|Oranges;Apples;Bananas;Mangos;Blueberries|;|*{item}|{newline}|sort=1}}</pre> {{Array|Oranges;Apples;Bananas;Mangos;Blueberries|;|*{item}|{newline}|sort=1}} ;Template in format example 1 <pre>{{Array|Venti;Jean;Diluc|;|{{Character|{item}|50}}}}</pre> {{Array|Nanafey;Kiana;Blade|;|{{Character|{item}|50}}}} ;Template in format example 2 <pre>{{Array|Venti;Jean;Diluc|;|²{Character¦{item}¦50}²|template=1}}</pre> {{Array|Nanafey;Kiana;Blade|;|^2{Character¦{item}¦50}^2|template=1}} ;Multi-character separator example <pre>{{Array|a&&b&&c&&d&&e|&&|{index}: {item}|,{space} }}</pre> {{Array|a&&b&&c&&d&&e|&&|{index}: {item}|,{space} }} ;Sentence example <pre>{{Array|Oranges;Apples;Bananas;Mangos;Blueberries|;|{item}|sentence=1}}</pre> {{Array|Oranges;Apples;Bananas;Mangos;Blueberries|;|{item}|sentence=1}} ;First item only example <pre>{{Array|Oranges;Apples;Bananas;Mangos;Blueberries|;|{item}|firstItemOnly=1}}</pre> {{Array|Oranges;Apples;Bananas;Mangos;Blueberries|;|{item}|firstItemOnly=1}} ;Offset start and end examples <pre>{{Array|A,B,C,D,E,F,G,H,I,J,K|,|{item}|join=,{space}|offsetStart=2}}</pre> {{Array|A,B,C,D,E,F,G,H,I,J,K|,|{item}|join=,{space}|offsetStart=2}} <pre>{{Array|A,B,C,D,E,F,G,H,I,J,K|,|{item}|join=,{space}|offsetStart=2|offsetEnd=5}}</pre> {{Array|A,B,C,D,E,F,G,H,I,J,K|,|{item}|join=,{space}|offsetStart=2|offsetEnd=5}} <pre>{{Array|A,B,C,D,E,F,G,H,I,J,K|,|{item}|join=,{space}|offsetStart=2|offsetEnd=2}}</pre> {{Array|A,B,C,D,E,F,G,H,I,J,K|,|{item}|join=,{space}|offsetStart=2|offsetEnd=2}} <pre>{{Array|A,B,C,D,E,F,G,H,I,J,K|,|{item}|join=,{space}|offsetStart=2|offsetEnd=-2}}</pre> {{Array|A,B,C,D,E,F,G,H,I,J,K|,|{item}|join=,{space}|offsetStart=2|offsetEnd=-2}} <pre>{{Array|A,B,C,D,E,F,G,H,I,J,K|,|{item}|join=,{space}|offsetStart=-2}}</pre> {{Array|A,B,C,D,E,F,G,H,I,J,K|,|{item}|join=,{space}|offsetStart=-2}} <pre>{{Array|A,B,C,D,E,F,G,H,I,J,K|,|{item}|join=,{space}|offsetStart=-1}}</pre> {{Array|A,B,C,D,E,F,G,H,I,J,K|,|{item}|join=,{space}|offsetStart=-1}} ;Item Specific Format <pre>{{Array|Item A,Item B,Item C|,|*''{item}''|{newline} |format2=*Item 2 specific format: '''{item}'''}}</pre> {{Array|1,2,3,4,5|,|*''{item}''|{newline} |format2=*Item 2 specific format: '''{item}'''}} ==Template Data== <templatedata> { "params": { "1": { "label": "Array String", "description": "The input string, each item expected to be separated by the \"separator\" parameter.", "example": "Item 1;Item 2;Item 3", "type": "string", "required": true }, "2": { "aliases": [ "sep", "separator" ], "label": "Separator", "description": "The character or substring to split on.", "example": ";", "type": "string", "required": true }, "3": { "aliases": [ "format" ], "label": "Format", "description": "The resulting format of each substring. See the template documentation page for more info.", "required": true, "type": "string" }, "4": { "aliases": [ "join" ], "label": "Join", "description": "The separator between each element to join.", "type": "string", "default": "(no separator)" }, "sentence": { "label": "Join as sentence", "description": "Set to 1 to format as a sentence (commas with an \"and\" for the last element).", "type": "boolean", "default": "0" }, "firstItemOnly": { "label": "First item only", "description": "Set to 1 to only display the first element of the array.", "type": "boolean", "default": "0" }, "sort": { "label": "Sort", "description": "Set to 1 to sort the items in the array in ascending order, -1 for descending.", "type": "number" }, "dedupe": { "label": "Dedupe?", "description": "Set to 1 to remove duplicate items in the array.", "type": "boolean" }, "removeEmpty": { "label": "Remove Empty Items", "description": "Set to 1 to remove empty elements.", "type": "boolean" }, "offsetStart": { "label": "Offset Start", "description": "Only keep elements of the array at and after this index.", "type": "number" }, "offsetEnd": { "label": "Offset End", "description": "Only keep elements of the array at and before this index.", "type": "number" } }, "description": "Divides a string into a formatted list of substrings." } </templatedata>
Summary:
Please note that all contributions to Honkai: Nexus Anima Wiki are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
Honkai Nexus Anima Wiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Preview page with this template
Below are commonly used wikitext from
MediaWiki:Edittools
. Click on any to insert them in the edit box.
Dynamic Page List
:
¦
²
«
»
²{¦}²
«»
«/»
«!----»
Array in DPL
:
¹
^2{
}^2
^2{¹}^2
Parser Functions
:
{{#if:||}}
{{#if:<condition>|<result if true>|<result if false>}}
{{#ifeq:|||}}
{{#ifeq:<text1>|<text2>|<result if text1=text2>|<result if text1≠text2>}}
{{#expr:}}
{{#expr:<mathematical expression>}}
{{#switch:||#default=}}
{{#switch:<text1>|<text2>=<result if text1=text2>|<text3>=<result if text1=text3>|#default=<result if no valid match>}}
{{#replace:||}}
{{#replace:<text1>|<plain text to find in text1>|<plain text to insert in place of the text found>}}
{{#titleparts:}}
{{#replace:<page name>}}
{{#tag:|}}
{{#tag:<name of html tag>|<content inside html tag>}}
Markup:
{{}}
|
[]
[[]]
[[Category:]]
#REDIRECT [[]] [[Category:Redirect Pages]]
<code></code>
<includeonly></includeonly>
<noinclude></noinclude>
<nowiki></nowiki>
<!---->
<br>
§
Notices:
{{Stub|}}
{{Stub Dialogue}}
{{Upcoming}}
{{Under Construction}}
{{Placeholder Image|}}
Magic Words
:
{{!}}
{{formatnum:}}
{{lc:}}
{{uc:}}
{{PAGENAME}}
{{FULLPAGENAME}}
{{ROOTPAGENAME}}
{{BASEPAGENAME}}
{{SUBPAGENAME}}
{{DISPLAYTITLE:|noreplace}}
__TOC__
__NOTOC__
__EXPECTUNUSEDCATEGORY__
__HIDDENCAT__
References:
<ref></ref>
{{Reflist}}
{{Ref/Arti|}}
{{Ref/ArtiSet|}}
{{Ref/BB|}}
{{Ref/Book|}}
{{Ref/CS|}}
{{Ref/Companion|}}
{{Ref/Domain|}}
{{Ref/Enemy|}}
{{Ref/Food|}}
{{Ref/Furnishing|}}
{{Ref/HEO|}}
{{Ref/Item|}}
{{Ref/Loading|}}
{{Ref/Location|}}
{{Ref/Manga|}}
{{Ref/NPC|}}
{{Ref/Outfit|}}
{{Ref/Quest|}}
{{Ref/Talent|}}
{{Ref/VO|}}
{{Ref/VP|}}
{{Ref/Weapon|}}
{{Ref/Wildlife|}}
HTML Entities:
—
,
­
Pages included on this page:
Template:Array
(
edit
)
Template:Character
(
edit
)
Template:Documentation/Header
(
edit
)
Template:Exists
(
edit
)
Template:Extension DPL
(
view source
)
Template:F
(
view source
) (fully protected)
Template:High Risk
(
edit
)
Template:Lua
(
edit
)
Template:MessageBox
(
edit
)
Template:Namespace
(
edit
)
Module:Arguments
(
view source
) (fully protected)
Module:Arguments/i18n
(
view source
) (fully protected)
Module:Array
(
view source
) (fully protected)
Module:Common/i18n
(
view source
) (fully protected)
Module:Config
(
view source
) (fully protected)
Module:Documentation
(
view source
) (fully protected)
Module:Documentation/config
(
view source
) (fully protected)
Module:Documentation/i18n
(
view source
) (fully protected)
Module:Entrypoint
(
view source
) (fully protected)
Module:Exists
(
view source
) (fully protected)
Module:Fallbacklist
(
view source
) (fully protected)
Module:Feature
(
view source
) (fully protected)
Module:Formatting
(
view source
) (fully protected)
Module:I18n
(
view source
) (fully protected)
Module:Item
(
edit
)
Module:Languages
(
view source
) (fully protected)
Module:Mbox
(
view source
) (fully protected)
Module:Mbox/i18n
(
view source
) (fully protected)
Module:Namespace detect
(
view source
) (fully protected)
Module:Namespace detect/config
(
view source
) (fully protected)
Module:Namespace detect/data
(
view source
) (fully protected)
Module:TableTools
(
view source
) (fully protected)
Module:Yesno
(
view source
) (fully protected)
This page is a member of 2 hidden categories:
Category:Pages Using DPL Parser Function
Category:Pages using DynamicPageList4
Search
Search
Editing
Template
:
Array/doc
Add topic