Substring/Top and tail: Difference between revisions

m
(3 intermediate revisions by 3 users not shown)
Line 734:
 
=={{header|EasyLang}}==
<syntaxhighlight lang="easylang">
strings$ = "EasyLangEasylang"
print substr strings$ 1 (len strings$ - 1 # Without the last character)
print substr strings$ 2 (len strings$ - 1 # Without the first character)
print substr strings$ 2 (len strings$ - 2 # Without the first and last characters)
</syntaxhighlight>
{{out}}
<pre>
Easylan
EasyLan
asylang
asyLang
asylan
asyLan
</pre>
 
Line 2,160:
 
=={{header|RPL}}==
Basic RPL:
{{trans|Python}}
"Knight" 2 OVER SIZE SUB
"Socks" 1 OVER SIZE 1 - SUB
"Brooms" 2 OVER SIZE 1 - SUB
From HP-48 versions, one can also do this way:
"Knight" TAIL
"Socks" REVLIST TAIL REVLIST
"Brooms" TAIL REVLIST TAIL REVLIST
{{out}}
<pre>
Line 2,534 ⟶ 2,538:
{{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.
<syntaxhighlight lang="ecmascriptwren">import "./str" for Str
 
var a = "Beyoncé"
1,995

edits