Substring: Difference between revisions

(→‎{{header|D}}: add implementation)
Line 168:
;
</lang>
 
=={{header|J}}==
 
<lang J> 5{.3}.'Marshmallow'
shmal
3}.'Marshmallow'
shmallow
}:'Marshmallow'
Marshmallo
({.~ i.&'m')'Marshmallow'
Marsh
5{.(}.~ I.@E.~&'sh')'Marshmallow'
shmal</lang>
 
Note that there are other, sometimes better, ways of accomplishing this task.
 
<lang J> 'Marshmallow'{~(+i.)/3 5
shmal</lang>
 
Note also that these operations work the same way on lists of numbers that they do on this example list of characters.
 
<lang J> 3}. 2 3 5 7 11 13 17 19
7 11 13 17 19</lang>
 
 
=={{header|Java}}==
6,962

edits