Otter
Snippets
Otter
Upstream Otter 1.0.1 Tested
Split Text and Rejoin with Delimiter
Deconstruct text by delimiter and reassemble parts with a new separator.
Architecture & Runtime Preview
Otter 1.0.1Zero-dependency Otter 1.0.1 snippet (Text & Strings). Copy the parameterized template or run the self-contained example.
- 1Category: Text & Strings
- 2Attribution: Otter Core Language Spec (D25)
- 3Zero external pack dependencies — paste directly into any .ot file
Source Code (2 files)
split ${sourceText} by "${delimiter}" into ${parts}
join ${parts} with "${newSeparator}" into ${result}
sentence is "alpha,beta,gamma,delta"
split sentence by "," into items
join items with " -> " into pipeline
say pipeline
if length of items is not 4
fail with "split items count mismatch: expected 4"
.
if pipeline is not "alpha -> beta -> gamma -> delta"
fail with "split-join pipeline mismatch"
.
Installation & Usage
otter snippet inspect text-split-join
Copy template.ot directly into your .ot source file, or run example.ot with 'otter run example.ot'.