Substring/Top and tail: Difference between revisions
Content added Content deleted
(Add source for Rust) |
(Added Wren) |
||
Line 1,946: | Line 1,946: | ||
Tail: UPRAISERS = UPRAISER |
Tail: UPRAISERS = UPRAISER |
||
Both: UPRAISERS = PRAISER</pre> |
Both: UPRAISERS = PRAISER</pre> |
||
=={{header|Wren}}== |
|||
{{libheader|Wren-str}} |
|||
As Wren's string slicing and other built-in methods generally work at the byte level, we use the above module for this task which works at the code-point level. |
|||
<lang ecmascript>import "/str" for Str |
|||
var a = "Beyoncé" |
|||
var b = Str.delete(a, 0) |
|||
var len = a.codePoints.count |
|||
var c = Str.delete(a, len-1) |
|||
var d = Str.delete(c, 0) |
|||
for (e in [a, b, c, d]) System.print(e)</lang> |
|||
{{out}} |
|||
<pre> |
|||
Beyoncé |
|||
eyoncé |
|||
Beyonc |
|||
eyonc |
|||
</pre> |
|||
=={{header|XPL0}}== |
=={{header|XPL0}}== |