Substring/Top and tail: Difference between revisions
Content added Content deleted
m (→{{header|Factor}}: show imports; factor out repetition) |
|||
Line 807: | Line 807: | ||
julia> "My String"[2:end-1] # without first and last characters |
julia> "My String"[2:end-1] # without first and last characters |
||
"y Strin"</lang> |
"y Strin"</lang> |
||
=={{header|K}}== |
|||
K provides the system function <code>_di</code> to delete an element at |
|||
a specified index. The following code is implemented using this feature. |
|||
<lang K> |
|||
s: "1234567890" |
|||
"1234567890" |
|||
s _di 0 /Delete 1st character |
|||
"234567890" |
|||
s _di -1+#s /Delete last character |
|||
"123456789" |
|||
(s _di -1+#s) _di 0 /String with both 1st and last character removed |
|||
"23456789" |
|||
</lang> |
|||
=={{header|Kotlin}}== |
=={{header|Kotlin}}== |