Substring/Top and tail: Difference between revisions
Content added Content deleted
Line 819: | Line 819: | ||
"123456789" |
"123456789" |
||
(s _di -1+#s) _di 0 /String with both 1st and last character removed |
(s _di -1+#s) _di 0 /String with both 1st and last character removed |
||
"23456789" |
|||
</lang> |
|||
Another way to implement without using the above system function: |
|||
<lang K> |
|||
s: "1234567890" |
|||
"1234567890" |
|||
1 _ s /Delete 1st character |
|||
"234567890" |
|||
-1 _ s /Delete last character |
|||
"123456789" |
|||
1 - -1 _ s /Delete 1st and last character |
|||
"23456789" |
"23456789" |
||
</lang> |
</lang> |