<split>
<split> is a General Operator
component that splits a numerical value or a text string into separate characters.
Attributes and Properties
Attributes for <split>
Other (3)
asListboolean. Default value: true. Whether to render the items separated by commas (true) or with no separator (false).
keyword. How to break the input string into pieces.
| Value | Description |
|---|---|
letter (default) | Split into individual characters. |
word | Split into whitespace-separated words. |
comma | Split on comma boundaries. |
typekeyword. Type of value being split.
| Value | Description |
|---|---|
text | Split text values. |
Common to all components (9)
copyreference. Create an independent copy of another component by reference. Enter a references a $name.
disabledboolean. Default value: false. Whether this component is disabled and cannot be interacted with.
extendreference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.
fixedboolean. Default value: false. Whether this component's value is fixed and cannot be modified.
fixLocationboolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
hideboolean. Default value: false. Whether to hide this component from the rendered output.
isResponseboolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.
nametext. The name used to reference this component from elsewhere in the document.
styleNumberinteger. Default value: 1. The style number used to select this component's visual styling from the available style definitions.
Properties for <split name="s">
Common to all components (4)
$s.doenetMLtext. The DoenetML source code that produced this component.
$s.hideboolean. Whether to hide this component from the rendered output.
$s.isResponseboolean. Whether this component is treated as a response for the purposes of assessment.
$s.styleNumberinteger. The style number used to select this component's visual styling from the available style definitions.
Examples
Example: <split> numbers from user-input
In this example, a numerical value is split into separate digits that can be retrieved by
by referring to the desired index of the named <split> component. Note that decimal
points will occupy their own index.
Example: <split> a text string
In this example, a text string value is split into separate characters that can be
retrieved by referring to the desired index of the named <split> component.
Note that spaces and puncuation will occupy their own index.
Attribute Examples
Attribute Example: splitBy
For text strings, the splitBy attribute can be used to adjust the type of splitting that occurs. The options are comma, letter, and word.