Jump to content

Substring/Top and tail: Difference between revisions

Added solution for Action!
mNo edit summary
(Added solution for Action!)
Line 86:
(str-rest "string")
(str-rest (str-rdc "string"))</lang>
 
=={{header|Action!}}==
<lang Action!>PROC Main()
CHAR ARRAY text="qwertyuiop"
CHAR ARRAY res(20)
BYTE n,m
 
PrintF("Original string:%E ""%S""%E%E",text)
 
SCopyS(res,text,2,text(0))
PrintF("String without the top:%E ""%S""%E%E",res)
 
SCopyS(res,text,1,text(0)-1)
PrintF("String without the tail:%E ""%S""%E%E",res)
 
SCopyS(res,text,2,text(0)-1)
PrintF("String without the top and the tail:%E ""%S""%E%E",res)
RETURN</lang>
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Top_and_tail.png Screenshot from Atari 8-bit computer]
<pre>
Original string:
"qwertyuiop"
 
String without the top:
"wertyuiop"
 
String without the tail:
"qwertyuio"
 
String without the top and the tail:
"wertyuio"
</pre>
 
=={{header|Ada}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.